View Single Post
  #1  
Old 04-01-2003, 02:30 AM
 
lesmckeown lesmckeown is offline
 

Newbie
  
Join Date: Mar 2003
Posts: 3
 

Default $Smarty assign won't parse

Hi folks -

I have a simple sql query I want to run conditionally in my product.tpl [depending on which product is selected]. It accesses an added mysql table containing additional product info.

I have written a small script, workshops.php, which I put in store/customer/, like this:

Code:
<? require "../smarty.php"; require "../config.php"; $workshop_dates = func_query("select * from $sql_tbl[workshop_dates]"); $smarty->assign("workshopdates",$workshop_dates); $smarty->display('workshops.tpl'); ?>

The file mentioned in the last line, 'workshops.tpl', is in [skin1]/customer/main, and looks like this:

Code:
<table width=100% cellpadding=0 cellspacing=0 border=0> <tr><td colspan=2><font class=ProductDetailsTitle>{$lng.lbl_workshop_dates}</font></td></tr> <tr><td class=Line height="1" colspan=3>[img]{$ImagesDir}/orangespacer.gif[/img]</td></tr> <tr><td colspan=2></td></tr> <tr class=TableHead> <td width="35%">Dates</td> <td>Availability</td> <td>Check to Register</td> <tr><td colspan=3></td></tr> {section name=workshopdates loop=$workshopdates} <tr > <td width="35%">{$workshopdates.dates}</td> <td>Availability</td> <td>Check to Register</td> <tr><td colspan=3></td></tr> {/section} <tr><td colspan=3></td></tr> </tr> </table>

Finally, I have an {if} statement in [skin1]/customer/main/product.tpl:
Code:
{if...etc} {include file="../customer/workshops.php"} {/if}

The problem is, no matter how I try to configure it, products.tpl chokes at the line beginning '$smarty->assign...' when parsing workshops.php.

It renders everything after the first '$smarty->' [ie from the word 'assign...' onward] in the browser as text, and the include of workshops.tpl doesn't happen.

Any idea where I've gone wrong?

All suggestions greatly appreciated!

Cheers

Les
Reply With Quote