X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   smarty template testing (https://forum.x-cart.com/showthread.php?t=6870)

Dion Jones 03-26-2004 01:47 AM

smarty template testing
 
Ok,
Newbie question but...
I am currently reading throught he smarty templates instruction book and have decided to test a couple of things out.

The first excercise is to see if smarty is working properly.
so I entered the following into the /customer/main/welcome.tpl:

$smarty->assign('name','dion');
<table border="0" cellpadding="2" cellspacing="0">
<tr>
<td>
Hello, {$name}!
</td>
</td>
</table>

Like it says in the book..
then it just displays the assign line and the name line without a name..
what am i doing wrong?

cheers.

shan 03-26-2004 04:48 AM

try wrap your first tag in {}

Dion Jones 03-26-2004 05:01 AM

tried that
it comes up with the error:


Fatal error: Smarty: [in customer/main/welcome.tpl line 7]: syntax error: unrecognized tag: $smarty->assign('name','dion'); (Smarty_Compiler.class.php, l in /var/www/html/store/Smarty-2.5.0/Smarty_Compiler.class.php on line 1832

shan 03-26-2004 05:02 AM

i take it you know about http://smarty.php.net

Dion Jones 03-26-2004 05:20 AM

yep. i've looked on there.. perhaps it's time to post a question on there...

I just thought someone might have tried it on here...

Dion Jones 03-26-2004 06:56 AM

aparently,
(I don't know why this didn't occur to me before)
but the $smarty->assign('name','dion');
is PHP. Where could i insert the PHP line?
does the home.php page exist as i can't find it anywhere?

shan 03-26-2004 07:00 AM

you have to imagine that the browser calls a php file which then assigns the smarty variables and then displays them in the smarty templates.

best way to suss it out is to look at one of the simple php pages of xcart and follow the logic through

Dion Jones 03-26-2004 07:31 AM

got it working.. cheers.
just had to find that pesky home.php file.
:D


All times are GMT -8. The time now is 01:16 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.