NYCPHP Meetup

NYPHP.org

[nycphp-talk] Smarty String Comparison

Kshitij Bedi Kbedi at inta.org
Thu Dec 4 15:09:38 EST 2003


Thank you Keith

-----Original Message-----
From: Keith Richardson [mailto:keith.richardson at thompsonhealth.com]
Sent: Thursday, December 04, 2003 3:04 PM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Smarty String Comparison


Sorry, i just did it in php :/ the thing was solved in a previous post
before i sent it, then realized it was about smarty :/

it can be found http://smarty.php.net/manual/en/language.modifier.lower.php

-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Kshitij Bedi
Sent: Thursday, December 04, 2003 3:02 PM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Smarty String Comparison


Would the strtolower function work inside a smarty template?

-----Original Message-----
From: Keith Richardson [mailto:keith.richardson at thompsonhealth.com]
Sent: Thursday, December 04, 2003 2:59 PM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Smarty String Comparison


You would need to change the case of the string, say strtolower($var) ==
"var"

if you want to compare a substring, use the function substr ($var, $start,
$end)

so if you wanted to compare the first 3 characters of $var to see if they
matched var, you would do

if (strtolower(substr($var,0,3)) == "var")
{
  dosomething;
}

-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Kshitij Bedi
Sent: Thursday, December 04, 2003 2:54 PM
To: 'NYPHP Talk'
Subject: [nycphp-talk] Smarty String Comparison


Hi there

Can someone tell me how to do case insensitive string comparison in smarty
templates.
and also how to trim strings while comparing them.

For e.g.
{if $var == "Var"} Display {/if}
if this is the statement how to I change it so that it trims $var and does a
case insensitive compare with "Var"
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk

_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk

_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk



More information about the talk mailing list