Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

$Smarty assign won't parse
 
Reply
   X-Cart forums > X-Cart 4 > Changing design
 
Thread Tools Search this Thread
  #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
  #2  
Old 04-01-2003, 02:54 AM
 
Alan Alan is offline
 

Advanced Member
  
Join Date: Feb 2003
Posts: 83
 

Default

Hello friend,

I believe that you cannot include .php files in a smarty include statement. You will have to get around that it by requiring the file in product.php using
Code:
require "./workshops.php"
NOTE: only if your workshops.php is saved under /yourxcart/customer/

Alter your if/else statement to fit .php style, or private message me with your if else statement and what you would like to do with it if you would like. (gramma alert! T_T)
__________________
Best Regards!
Alan
Search is my friend
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:45 PM.

   

 
X-Cart forums © 2001-2020