By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,643 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

How to use this function in Smarty?

100+
P: 133
Hi,

Can someone please help me, i am trying to use this function but simply wont display when i try it.

The function is:

[php]function stripres($value){

$value = strtr($value, "ABCDEFGHIJKLMNOPQRSTUVWXYZ. ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz--");
$value = ereg_replace('[^a-zA-Z0-9_-]', '', $value);

return $value;

}[/php]

I am trying to use this by:

{stripres($result.subcategory)}

What am i doing wrong?

Cheers,
Adam
Feb 12 '08 #1
Share this Question
Share on Google+
1 Reply


dlite922
Expert 100+
P: 1,584
Hi,

Can someone please help me, i am trying to use this function but simply wont display when i try it.

The function is:

[php]function stripres($value){

$value = strtr($value, "ABCDEFGHIJKLMNOPQRSTUVWXYZ. ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz--");
$value = ereg_replace('[^a-zA-Z0-9_-]', '', $value);

return $value;

}[/php]

I am trying to use this by:

{stripres($result.subcategory)}

What am i doing wrong?

Cheers,
Adam
i don't think you can access PHP functions like that from smarty. You can modify smarty and add that custom function to smarty class.

Where is your smarty assign() lines?

My suggestion, put that into a class, create an instance, assign it to smarty and access it like this

{$assignedName->stripres($result.category)}

IF YOU WANT TO CONVERT TO LOWERCASE DO THIS

{$result.category|lower}

change lower to upper if you want it upper case.
Feb 20 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.