Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

2 newbie questions

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Christian
Smarty n00b


Joined: 19 Jun 2003
Posts: 4
Location: Hessen, Deutschland

PostPosted: Thu Jun 19, 2003 10:18 pm    Post subject: 2 newbie questions Reply with quote

Hi and hello. I am new to Smarty and today I tried to wrote my templates for smarty.


[root@localhost htdocs]# php index.php
Content-type: text/html
X-Powered-By: PHP/4.3.1

<br />
<b>Fatal error</b>: Smarty: [in header.tpl line 51]: syntax error: unrecognized tag: {$skin_zusatz (Smarty_Compiler.class.php, line 382) in <b>/usr/webserver1/christiankorff.de/beta1/smarty/libs/Smarty_Compiler.class.php</b> on line <b>1824</b><br />

How to know that I am making wrong? I use a lot of code in the following form:
<a href="?{if $skin_zusatz != ""}{$skin_zusatz}{/if}">HOME</a>


The second question is very simple:
How to escape the { in Smarty Templates?
Back to top
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Thu Jun 19, 2003 10:36 pm    Post subject: Reply with quote

First why not use {$skin_zusatz|default:""} so if the var doesnt exist it will show nothing and second put the text in {literal}...{/literal} to not have it parse the {}
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Jun 19, 2003 11:24 pm    Post subject: Reply with quote

Hello, Christian.

That does look weird. AZTEK certainly has the right idea Smile (Hi Aztek)

What does this do for you?
Code:
<a href="?{if $skin_zusatz}{$skin_zusatz}{/if}">HOME</a>


As for escaping the delimiters, see: this thread. Further, $smarty->left_delimiter and $smarty->right_delimiter define the delimiters (you can set them to anything convenient for your purposes.)

greets.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP