Hi all,

I have a problem with the following. I want to use a "do while" statement in a script that uses Smarty template.

The do while I want us use is in the template file.

This is what I have:

<?php do { ?>
<tr>
<td><?php echo $row_accom['a_name']; ?></td>
<td><?php echo $row_accom['a_country']; ?></td>
<td><?php echo $row_accom['a_arrival']; ?></td>
<td><?php echo $row_accom['a_departure']; ?></td>
</tr>
<?php } while ($row_active_accomm = mysql_fetch_assoc($active_accomm)); ?>

When I run the script I get a Smarty error saying "ERROR [256] Smarty error: [in profile.html line 776]: syntax error: unrecognized tag: ?> "

Line 776 is "<?php do { ?>" and it is the "?>" that is causing the error. Is there a way I can get around this error by using some sort of escape code around the offending code.

    check out
    http://smarty.php.net/manual/en/smarty.for.designers.php

    Your tpl file shouldn't be using php tags, you want to use simply {} to escape in and out of parsing data passed by smarty.

    //page.php
    $myVar = 'myValue';
    
    $smarty->assign('myVar', $myVar);
    .
    .
    .
    
    //page.tpl
    {$myVar} //equivilent to php code 'echo $myVar;'
    
    
      Write a Reply...