![]() |
NEED HELP FAST !!!
I have a value in a template, lets call it {$code}
This value is 4 characters long. (ie "SDUI") I need to display the 2nd character only. Remember that I am in a template. In VB it would be something like SUBSTR($code,2,1). How do you display the 2nd character on the screen, without showing the other three characters from within a .tpl file..... PLEASE HELP ANYBODY ??? |
I couldn't find a smarty modifier to do this automatically, so here's the plan:
In your smarty.php file, add this code: Code:
$smarty->register_modifier("substr", "substr"); Right above this line: Code:
$mail_smarty = $smarty; Then in your templates, you can say: Code:
{$code|substr:1,1} Remeber that the 1st character of a string is in position 0 so the 2nd character is in position 1. Hope this helps! (This is untested, BTW) |
All times are GMT -8. The time now is 09:29 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.