![]() |
Smarty Variable printing
Hi I am trying to print from the 180th character position using the smarty truncate function. Can only get it to print from starting starting position and not starting from the middle of the string.
is there a way of doing this with truncate or is there a another function.? {$product.descr|truncate:85} this prints the first 85 characters. I need to be able to print from starting to ending positions in php i would use substr thanks rob |
Re: Smarty Variable printing
|
Re: Smarty Variable printing
Thanks for your reply but i could not find the way to do it that way.
i added my code to the product.php page ### Split up product description $desc1 = substr($product_info["descr"] , 0, 244); $desc6 = substr($product_info["descr"] , 248,45); $desc7 = substr($product_info["descr"] , 297,45); $smarty->assign("desc1", $desc1); $smarty->assign("desc6", $desc6); $smarty->assign("desc7", $desc7); ## rob. |
Re: Smarty Variable printing
Read that Smarty modifier page a little closer. All PHP functions are implicitly usable as Smarty modifiers. Try:
{$product.descr|truncate:244} {$product.descr|substr:248:45} {$product.descr|substr:297:45} |
Re: Smarty Variable printing
Thank you. This is very useful to know.
rob |
All times are GMT -8. The time now is 06:09 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.