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

Hey guys beginner question

 
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
smartflower2002
Smarty n00b


Joined: 21 Apr 2010
Posts: 2

PostPosted: Wed Apr 21, 2010 7:40 pm    Post subject: Hey guys beginner question Reply with quote

hi guys, i am making a php script and i thought to use smarty.
so can u please give me a nice tutorial to use smaty.

and second thing.
how to use php functions in smarty.eg

$test = true;
if $test
{
echo "its true";
}
else
{
echo "its false";
}


now incase if i want to use that $true in smarty how can i?

please and thanks
Back to top
View user's profile Send private message
waro
Smarty Regular


Joined: 12 Jun 2008
Posts: 38

PostPosted: Thu Apr 22, 2010 8:17 am    Post subject: Reply with quote

I use this crash course when I first learn about Smarty. And the manual is also a great help too.
Back to top
View user's profile Send private message
surendran
Smarty n00b


Joined: 22 Apr 2010
Posts: 3

PostPosted: Thu Apr 22, 2010 11:47 am    Post subject: Reply with quote

$smarty->assign('value' , $true);

in smarty as

{$value}
Back to top
View user's profile Send private message
smartflower2002
Smarty n00b


Joined: 21 Apr 2010
Posts: 2

PostPosted: Thu Apr 22, 2010 5:02 pm    Post subject: Reply with quote

hmm, crash course doesnt solve my querry.

i need to use function in if statement.
Back to top
View user's profile Send private message
douglassdavis
Smarty Junkie


Joined: 21 Jan 2008
Posts: 541

PostPosted: Thu Apr 22, 2010 5:40 pm    Post subject: Reply with quote

smartflower2002 wrote:
hmm, crash course doesnt solve my querry.

i need to use function in if statement.


i don't understand your first post. there is no function there.

do you want to use an if statement?

http://www.smarty.net/manual/en/language.function.if.php
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Apr 22, 2010 11:57 pm    Post subject: Reply with quote

Code:
$smarty->assign('test',true);


Code:
{if $test}
   its true
{else}
  its false
{/if}
Back to top
View user's profile Send private message Visit poster's website
Kim Steinhaug
Smarty n00b


Joined: 26 Apr 2010
Posts: 3

PostPosted: Mon Apr 26, 2010 11:17 am    Post subject: Reply with quote

Directly in the template, you could do this:

Code:
{assign var='test' value='1'}
{if $test}
{else}
{/if}


Regards,
Kim Steinhaug
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