Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

{IF} {ELSE} Statements

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
brown-hornettt
Smarty n00b


Joined: 01 Mar 2007
Posts: 3

PostPosted: Sat Mar 03, 2007 4:31 pm    Post subject: {IF} {ELSE} Statements Reply with quote

Can smartyvalidate be used within an {if} statement ?????

I have tried like this in a submit.tpl file and cannot get validation to work.....

{if $foo == 1}

smartyvalidate statement 1 here

{else}

smartyvalidate statement 2 here

{/if}

But each of the smartyvalidate statements work if they are not inside of the {if} statement..................
Back to top
View user's profile Send private message
brown-hornettt
Smarty n00b


Joined: 01 Mar 2007
Posts: 3

PostPosted: Sun Mar 04, 2007 2:27 am    Post subject: Reply with quote

Does anyone have any idea if smarty can be used inside an {if} statement and if so what is the proper format, or maybe someone could direct me to where i can find more info about this
Back to top
View user's profile Send private message
JasonDS
Smarty Rookie


Joined: 25 Jan 2007
Posts: 25

PostPosted: Fri Mar 09, 2007 4:09 pm    Post subject: Reply with quote

You're using invalid Smarty syntax, you can't use '==', you should use 'eq'

Code:

{if $foo eq 1}
Back to top
View user's profile Send private message Send e-mail
TGKnIght
Smarty Junkie


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

PostPosted: Fri Mar 09, 2007 5:24 pm    Post subject: Reply with quote

JasonDS wrote:
You're using invalid Smarty syntax, you can't use '==', you should use 'eq'


@JasonDS RTFM.. http://smarty.php.net/manual/en/language.function.if.php

@hornet Can you give a better idea of what you're trying to accomplish here? Maybe a real example of what you already tried instead of the pseudocode?
_________________
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
JasonDS
Smarty Rookie


Joined: 25 Jan 2007
Posts: 25

PostPosted: Fri Mar 09, 2007 6:30 pm    Post subject: Reply with quote

You should be more respectful, not everyone knows everything, get lost dumbass
Back to top
View user's profile Send private message Send e-mail
boots
Administrator


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

PostPosted: Sat Mar 10, 2007 3:34 am    Post subject: Reply with quote

JasonDS wrote:
You should be more respectful, not everyone knows everything, get lost dumbass


Confused Can we please refrain from name calling?

I don't think you needed to take that personally, JasonDS. TGKnight was correct to point you to the manual. Everyone makes mistakes but it would be best not to give advice unless you are certain that it is correct advice. In this case, it seems you never fully read the manual in regards to the answer you gave. I think TGKnight was only trying to help you learn something that didn't already know.

I've noticed that you have given some good answers here in the forums but occasionally you give some unresearched advices. Your enthusiasm is very welcome and refreshing but it would be better to either not answer if you are uncertain or better yet, to first verify the answer you are giving.

Most of all, it would mean a lot to me personally if users didn't attack one-another.

Best Regards!
Back to top
View user's profile Send private message
TGKnIght
Smarty Junkie


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

PostPosted: Tue Mar 13, 2007 2:11 pm    Post subject: Reply with quote

JasonDS wrote:
You should be more respectful, not everyone knows everything, get lost dumbass


... I would say 90% of the time I post something on this forum, I either know the answer by rote, or by researching the answer... I always try to provide links to the manual if possible so that the OP can learn to do a little research on their own.

It bothers me when I see someone post something that is inaccurate when the correct answer is readily available.

But you're right.. "RTFM..." was harsh.. next time I will use "RTFM!!!"

P.S. Feel free to correct me at anytime.. My pride might be bruised, but I'd rather know the right answer.
_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins 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