section title block
| From: | Sergey Egorov | Date: | Sat, 24 Feb 2001 21:53:42 +0000 |
| Subject: | section title block | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-214@lists.php.net to get a copy of this message | ||
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