Page 1 of 1

if/else statements seem impossible

Posted: Mon Mar 09, 2009 11:06 pm
by weaselweasel
I've been searching for hours now, but can't find the solution for this simple issue. Searched all forums, but no luck...

All I want to do is build this inside a template:

{$myname = 'bob'}

{if $myname == 'bob'} Hello I'm Bob! {else} I am not Bob {/if}


It's as simple as that, and still it's the most difficult issue in CMSMS I have ever faced. (after 2 hours of trying, I'm starting to wonder if it's even possible).

Someone please help.

Cheers,
Jeroen

Re: if/else statements seem impossible

Posted: Mon Mar 09, 2009 11:41 pm
by Nullig
Try:

{assign var=myname value='bob'}

Nullig

Re: if/else statements seem impossible

Posted: Mon Mar 09, 2009 11:52 pm
by weaselweasel
You're a hero!
Works like a charm! Thanks a bunch.

(They should put this somewhere in the manual though)

Re: if/else statements seem impossible

Posted: Mon Mar 09, 2009 11:54 pm
by calguy1000
weaselweasel wrote: (They should put this somewhere in the manual though)
It is... You just didn't read it:

http://smarty.net/manual/en/

Re: if/else statements seem impossible

Posted: Tue Mar 10, 2009 12:12 am
by weaselweasel
calguy1000 wrote:
weaselweasel wrote: (They should put this somewhere in the manual though)
It is... You just didn't read it:

http://smarty.net/manual/en/
Aha, that link comes in very handy. Thanks again.