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

how to write this if statement in smarty ?

 
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
feelexit
Smarty Rookie


Joined: 06 Dec 2004
Posts: 29

PostPosted: Mon Jan 22, 2007 12:39 pm    Post subject: how to write this if statement in smarty ? Reply with quote

{if file_exists('usrimage/iconthumb/' + $smarty.session.uname + '.jpg')}

something wrong this if statement.

$smarty.session.uname is 'admin'

if i use {if file_exists('usrimage/iconthumb/admin.jpg')} , i got right image back.

I want know how to rewrite it , so i can have smarty variable in the if statement.
Back to top
View user's profile Send private message
Hielke Hoeve
Smarty Elite


Joined: 06 Jan 2006
Posts: 406
Location: Netherlands

PostPosted: Mon Jan 22, 2007 9:46 pm    Post subject: Reply with quote

you cant`t use `+ $smarty.session.uname +`. $smarty probably isn`t a valid variable within smarty, as in you didn`t add it to smarty using ->assign(). assigning a new variable with some user information for this sort of information is often the easiest.
_________________
Debug XHTML Compliance
SmartyPaginate
Smarty License Questions
---
(About Unix) The learning curve is full of aha! moments, such as that glorious day that the full beauty of grep and, later, find is revealed in all its majesty. --- Robert Uhl <ruhl@4dv.net>
Back to top
View user's profile Send private message
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Tue Jan 23, 2007 2:31 pm    Post subject: Reply with quote

Why doesn't this work?

Code:

{if file_exists("usrimage/iconthumb/`$smarty.session.uname`.jpg")}


http://smarty.php.net/manual/en/language.syntax.quotes.php
_________________
Smarty site with one index.php controller file
Working with MySQL and Smarty
SmartyColumnSort
Custom Smarty Javascript Debug Template
Back to top
View user's profile Send private message Visit poster's website
feelexit
Smarty Rookie


Joined: 06 Dec 2004
Posts: 29

PostPosted: Sat Jan 27, 2007 12:08 pm    Post subject: Reply with quote

TGKnIght wrote:
Why doesn't this work?

Code:

{if file_exists("usrimage/iconthumb/`$smarty.session.uname`.jpg")}


http://smarty.php.net/manual/en/language.syntax.quotes.php


TGKnIght, thanx alot. got it work now.
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