if/else statements seem impossible

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
weaselweasel
Forum Members
Forum Members
Posts: 23
Joined: Mon Dec 03, 2007 9:32 pm

if/else statements seem impossible

Post 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
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: if/else statements seem impossible

Post by Nullig »

Try:

{assign var=myname value='bob'}

Nullig
weaselweasel
Forum Members
Forum Members
Posts: 23
Joined: Mon Dec 03, 2007 9:32 pm

Re: if/else statements seem impossible

Post by weaselweasel »

You're a hero!
Works like a charm! Thanks a bunch.

(They should put this somewhere in the manual though)
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: if/else statements seem impossible

Post 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/
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
weaselweasel
Forum Members
Forum Members
Posts: 23
Joined: Mon Dec 03, 2007 9:32 pm

Re: if/else statements seem impossible

Post 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.
Post Reply

Return to “CMSMS Core”