|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
insectis Smarty n00b
Joined: 27 Aug 2003 Posts: 4
|
Posted: Wed Aug 27, 2003 10:48 pm Post subject: Loop Question |
|
|
Hey all,
I just started using Smarty, so this will most likely be a stupid question.
My problem is: I'm grabbing info from a database, putting it into a variable and then using that variable in the TPL file. According to the debugging info, I'm populating the variables correctly; I can't, however, get the variables to print anything when calling them from the TPL.
Here's my code:
[php:1:8bf470e22c]<?php
for ($i = 1; $i < $newsNumRows + 1; $i++) {
$newsRow = mysql_fetch_array($newsResult);
$smarty->assign("newsDate[$i]", $newsRow['date']);
$smarty->assign("newsTitle[$i]", $newsRow['title']);
$smarty->assign("newsSource[$i]", $newsRow['source']);
}
?>[/php:1:8bf470e22c]
Code: |
{section name=news loop=$newsTitle}
{strip}
<table width="430" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15" valign="top"><img src="../images/bullet_wtrdrop1.gif" width="15" height="12"></td>
<td width="100%"><span class="Utxt1"><b>{$newsDate[news]}</b></span><br>
<a href="article_062203.htm">{$newsTitle[news]}</a>., <i>{$newsSource[news]}</i></td>
</tr>
</table>
<table width="430" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30"><img src="../images/divline_1.gif" width="430" height="7"></td>
</tr>
</table>
{/strip}
{/section}
|
Any help would be greatly appreciated![/code]
?>[/php] |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Aug 28, 2003 1:08 am Post subject: |
|
|
Hi insectis--I think that this thread will be helpful. If not, shout out and I'll try to do better for ya |
|
Back to top |
|
insectis Smarty n00b
Joined: 27 Aug 2003 Posts: 4
|
Posted: Thu Aug 28, 2003 4:48 pm Post subject: |
|
|
Perfect! Thanks a lot! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|