Reputation: 1760
I'm new in smarty!I have a loop to print a table!but it's make synatc error what's wrong ?
{foreach $messages as $message}
<tr style="{if !$message->read }font-weight:bold;{/if}">
<td style="width: 3%; background: #EFEFEF" align="center"><input type="checkbox" name="selected[]" class="selected" value="{$account->username}{chr(22)}{$account->email}" /></td>
<td style="width: 3%;" align="center" >{$smarty.get.offset+($message@index+1)}</td>
<td style="width: 20%;" >{$message->from}{if $message->firstname || $message->lastname}<span style="font-size:10px;font-weight:normal;color:#666"> <br />{$message->firstname} {$message->lastname}</span>{/if}</td>
<td style="width: 46%;" ><a href="{$smarty.server.PHP_SELF}?mod=message&caption=get&id={$message->id}">{$message->subject}</a></td>
<td style="width: 30%;" >{lib_abstracts::convertTime($message->cDate, '', TRUE, TRUE)}</td>
</tr>
{/foreach}
Upvotes: 2
Views: 926
Reputation: 270617
Your foreach
syntax is incorrect. You're using PHP style foreach
. Smarty's is a bit different. Note: your syntax is valid for Smarty 3. If you're using Smarty 2.x, use:
{foreach from=$messages item=message}
....
{/foreach}
Upvotes: 1
Reputation: 1760
You have white space in here ->read }
remove this and it'll be work
<tr style="{if !$message->read }font-weight:bold;{/if}">
Upvotes: 3