Re: section title block
| From: | Monte Ohrt | Date: | Sun, 25 Feb 2001 06:20:14 +0000 |
| Subject: | Re: section title block | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-216@lists.php.net to get a copy of this message | ||
Monte Ohrt wrote:
> I think this can be done now:
>
> {section name=mystuff loop=$data}
> {if %mystuff.loop% eq 0}
> {include file="section_header.tpl"}
> {/if}
> {* section row data goes here *}
> {if %mystuff.rownum% eq $mystuff.loop%}
typo above, should be %mystuff.loop%
>
> {include file="section_footer.tpl"}
> {/if}
> {/section}
>
> Sergey Egorov wrote:
>
> > Hello !
> >
> > I suppose that the following example is common.
> > As it is very annoying to write like this every time we have header,
> > rows and footer parts:
> >
> > --------------------------------------------------------------------------------------------
> > {if count($messages) > 0}
> > <table CELLPADDING="0" CELLSPACING="0" BORDER="1">
> > <tr>
> > <td CLASS="bodytext">{$global_strings.message}</td>
> > <td CLASS="bodytext">{$global_strings.description}</td>
> > <td> </td>
> > </tr>
> > {section name="rows" loop=$messages}
> > <tr>
> > <td CLASS="bodytext">{$rows/messages.message}</td>
> > <td CLASS="bodytext">{$rows/messages.desc}</td>
> > <td> </td>
> > </tr>
> > {/section}
> > </table>
> > {else}
> > <p CLASS="bodytext">{$global_strings.no_messages}</p>
> > {/if}
> >
> > --------------------------------------------------------------------------------------------
> >
> > I sugguest to add more functionality to the {section} tag.
> > For example:
> >
> > {section...}
> > //section row goes here
> > {section_header}
> > //section header data goes here
> > {section_footer}
> > //section footer data goes here
> > {sectionelse}
> > {/section}
> >
> > OR
> >
> > {section...}
> > {section_header}
> > //section header data goes here
> > {section_rows}
> > //section row goes here
> > {section_footer}
> > //section footer data goes here
> > {sectionelse}
> > {/section}
> >
> > OR
> >
> > {section...}
> > //section header data goes here
>
> > {section_rows}
> > //section row goes here
> > {section_footer}
> > //section footer data goes here
> > {sectionelse}
> > {/section}
> >
> > section_header and section_footer are ignored if there are no rows of
> > course.
> >
> > What do you think?
> >
> > --
> > Best regards,
> > Sergey mailto:esv@37.ru
> >
> > ---
> > You are currently subscribed to smarty as: monte@ispi.net
> > To unsubscribe send a blank email to $subst('Email.Unsub')
> > Visit Smarty's homepage at
> > http://www.phpinsider.com/php/code/Smarty/
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/