Page 1 of 1

[FormBuilder] Template / Smarty-Frage

Posted: Sun Jun 17, 2007 7:08 pm
by amh
Hi Pros!

Ich verzweifle mangels Programmierkenntnissen an folgendem Smarty-Template:

Code: Select all

{$hidden}
{assign var="cols" value="3"}

{if $total_pages gt 1}<span>{$title_page_x_of_y}</span>{/if}
{foreach from=$fields item=entry}
          <!-- {$entry|print_r} -->
	  {if $entry->display == 1}
	    	{strip}
                {* leading div before the tag *}
                {if $entry->type != "-Fieldset Start" && $entry->type != "-Fieldset End"}
	    	<p
	    	{if $entry->required == 1 || $entry->css_class != ''} class=" 
	    		{if $entry->required == 1}
	    			required
	    		{/if}
	    		{if $entry->required == 1 && $entry->css_class != ''} {/if}
	    		{if $entry->css_class != ''}
	    			{$entry->css_class}
	    		{/if}
	    		"
	    	{/if}
	    	>
                {/if}
                {* begin field output *}
	    	{if $entry->hide_name == 0}
	    		<label for="{$entry->input_id}">{$entry->name}</label>
	    		{if $entry->required_symbol != ''}
	    			{$entry->required_symbol}
	    		{/if}
	    	{/if}
	    	
	    	{* eigener Eintrag *}
	    	{if $entry->type == "-Statischer Text"}
	    		<!-- hallo --> 
	    	{/if}
	    	
	    	{if $entry->multiple_parts == 1}
    		<table>
					<tr>
				{section name=numloop loop=$entry->input}
	    			<td>{$entry->input[numloop]->input} {$entry->input[numloop]->name}</td>
	    			       {if not ($smarty.section.numloop.rownum mod $cols)}
                				{if not $smarty.section.numloop.last}
                        		</tr><tr>
                				{/if}
        					{/if}
       				{if $smarty.section.numloop.last}
                		{math equation = "n - a % n" n=$cols a=$entry->input|@count assign="cells"}
                		{if $cells ne $cols}
                			{section name=pad loop=$cells}
                        		<td> </td>
                			{/section}
               		 	{/if}
                		</tr>
        			{/if}
	    		{/section}
	    		</table>
	    	{else}
	    		{$entry->input}
	    	{/if}
	    	{if $entry->valid == 0} <--- {/if}
                {* trailing div *}
                {if $entry->type != "-Fieldset Start" && $entry->type != "-Fieldset End"}
	    	</p>
                {/if}
	    	{/strip}
	  {/if}
{/foreach}
{$prev}{$submit}
Im Besonderen geht es darum, die Tabelle wegzubekommen. Leider scheint auch die Abfrage {if $entry->multiple_parts == 1} nicht so recht zu wollen, denn bei einem normalen Text gibt er folgendes aus:

Code: Select all

<!-- stdClass Object (
    [display] => 1
    [required] => 0
    [required_symbol] => 
    [css_class] => 
    [valid] => 1
    [hide_name] => 0
    [name] => 
    [input] => </td></tr></table><span class="textnormal">
<p>Hier kommt dann der Text</p>
</span><table class="formbuilderform">
    [input_id] => m2_68
    [multiple_parts] => 0
    [type] => -Statischer Text
) 1 -->
	  	    	<p><label for="m2_68"></label><!-- hallo --></td></tr></table><span class="textnormal">

<p>Hier kommt dann der Text</p>
</span><table class="formbuilderform"></p>
Eigentlich sollte da nur eine einfaches p sein. Aber der macht da nun eine table auf und nicht mehr zu. Das ist nicht nur unlogisch, sonder verhaut auch mein ganzes Layout  :'(  :'(  :'(  :'(  :-\

Wer kann helfen?  ??? Wäre echt DANKBAR!!!!!

Vielleicht würde es auch helfen diesen Teil zu kommentieren. Was machen die einzelnen Zeilen. Ich weiß viel Arbeit, aber vielleicht hat einer einen tollen Tipp, oder stand bereits vor diesem Problem.

Code: Select all

{if $entry->multiple_parts == 1}
    		<table>
					<tr>
				{section name=numloop loop=$entry->input}
	    			<td>{$entry->input[numloop]->input} {$entry->input[numloop]->name}</td>
	    			       {if not ($smarty.section.numloop.rownum mod $cols)}
                				{if not $smarty.section.numloop.last}
                        		</tr><tr>
                				{/if}
        					{/if}
       				{if $smarty.section.numloop.last}
                		{math equation = "n - a % n" n=$cols a=$entry->input|@count assign="cells"}
                		{if $cells ne $cols}
                			{section name=pad loop=$cells}
                        		<td> </td>
                			{/section}
               		 	{/if}
                		</tr>
        			{/if}
	    		{/section}
	    		</table>