| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Smarty Variable printing | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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
__________________
X-Cart version 4.1.9 PHP 5.2.13 Details >> GD bundled (2.0.34 compatible) MySQL server 5.0.77-log MySQL client 5.0.77 Web server Apache/2.2 Operation system Linux Perl not found XML parser (expat) found |
|||||||
#2
|
|||||||||
|
|||||||||
![]()
__________________
X-Cart version 5 (Previously 3.5-4) Previous Versions included BCSE Reward Points Mod Altered Cart On Sale Mod Wordpress Plugin Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there. Shout me a Coffee! |
|||||||||
#3
|
|||||||
|
|||||||
![]() 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.
__________________
X-Cart version 4.1.9 PHP 5.2.13 Details >> GD bundled (2.0.34 compatible) MySQL server 5.0.77-log MySQL client 5.0.77 Web server Apache/2.2 Operation system Linux Perl not found XML parser (expat) found |
|||||||
#4
|
|||||||
|
|||||||
![]() 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}
__________________
Manuka Bay Company X-Cart Version 4.0.19 [Linux] UGG Boots and other fine sheepskin products http://www.snowriver.com |
|||||||
#5
|
|||||||
|
|||||||
![]() Thank you. This is very useful to know.
rob
__________________
X-Cart version 4.1.9 PHP 5.2.13 Details >> GD bundled (2.0.34 compatible) MySQL server 5.0.77-log MySQL client 5.0.77 Web server Apache/2.2 Operation system Linux Perl not found XML parser (expat) found |
|||||||
![]() |
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|