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

smarty template testing

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-26-2004, 01:47 AM
 
Dion Jones Dion Jones is offline
 

Newbie
  
Join Date: Mar 2004
Location: staffordshire uk
Posts: 9
 

Default 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.
__________________
Dion Jones,
Web Dev, Db admin
www.smallislandtrader.com
X-cart Ver. 3.5.4
o/s Windows2000
Reply With Quote
  #2  
Old 03-26-2004, 04:48 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

try wrap your first tag in {}
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 03-26-2004, 05:01 AM
 
Dion Jones Dion Jones is offline
 

Newbie
  
Join Date: Mar 2004
Location: staffordshire uk
Posts: 9
 

Default

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
__________________
Dion Jones,
Web Dev, Db admin
www.smallislandtrader.com
X-cart Ver. 3.5.4
o/s Windows2000
Reply With Quote
  #4  
Old 03-26-2004, 05:02 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

i take it you know about http://smarty.php.net
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #5  
Old 03-26-2004, 05:20 AM
 
Dion Jones Dion Jones is offline
 

Newbie
  
Join Date: Mar 2004
Location: staffordshire uk
Posts: 9
 

Default

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,
Web Dev, Db admin
www.smallislandtrader.com
X-cart Ver. 3.5.4
o/s Windows2000
Reply With Quote
  #6  
Old 03-26-2004, 06:56 AM
 
Dion Jones Dion Jones is offline
 

Newbie
  
Join Date: Mar 2004
Location: staffordshire uk
Posts: 9
 

Default

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?
__________________
Dion Jones,
Web Dev, Db admin
www.smallislandtrader.com
X-cart Ver. 3.5.4
o/s Windows2000
Reply With Quote
  #7  
Old 03-26-2004, 07:00 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

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
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #8  
Old 03-26-2004, 07:31 AM
 
Dion Jones Dion Jones is offline
 

Newbie
  
Join Date: Mar 2004
Location: staffordshire uk
Posts: 9
 

Default

got it working.. cheers.
just had to find that pesky home.php file.
__________________
Dion Jones,
Web Dev, Db admin
www.smallislandtrader.com
X-cart Ver. 3.5.4
o/s Windows2000
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 10:38 AM.

   

 
X-Cart forums © 2001-2020