displaying data from database
| From: | Alexander Plakidin | Date: | Fri, 02 Nov 2001 20:36:07 +0000 |
| Subject: | displaying data from database | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-1819@lists.php.net to get a copy of this message | ||
Hi People,
I'm new to Smarty (decided to migrate to Smarty from FastTemplate). Smarty really looks
pretty cool, and I like it much more than FastTemplate. It seems to run much faster (I
didn't do any tests, though), and provides alot of nice features.
I am only wondering if I am using a right approach to display repeating data from
database. I was researching docs - they all say that data should be firstly retrieved into
an array, and then displayed with FastTemplate. Pretty simple, yeah... I just wonder if
this method is efficient enough - it is possible that a big amount of data will be
retrieved from database, and I am wondering if it can cause a slowdown. Can you, guys,
tell me if I am wrong, and this approach is OK?
I am currently using a scheme like this:
{* firstly retrieve data from database *}
{* this will run a query and assign a variable which contains number of rows *}
{initiate_display}
{section name=blabla loop=$numRows}
{* here I jump to next record, and retrieve current row to $RECORD array}
{next_record}
{* and finally perform some output *}
{$RECORD.id}. {$RECORD.title}<br>
{/section}
Actually, I don't like it as I have to write some custom functions, etc... Please point me
to a right direction ;)
Thanks,
Alex.