| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
combining truncate and replace | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
combining truncate and replace
I am trying to remove the commas from my meta_keywords variable and replace them with nothing "" in this line
Code:
and truncate it to the 5th word. (I haven't started on the "5th word" part) This is what I was trying without much success along with a couple of other variations. Code:
Anyone know how to do that?
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3 mods: reCaptcha running on UNIX www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2 mods: reCaptcha cdseo pro running on UNIX |
|||||||
#2
|
|||||||
|
|||||||
Re: combining truncate and replace
I got replacing the commas worked out and truncating to the 100th character while keeping the last full word intact. Looks like this now.
Code:
using this to create unique alt tags for my logo image on each page. The alt tag will match with the first few words of my meta_keywords on each page.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3 mods: reCaptcha running on UNIX www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2 mods: reCaptcha cdseo pro running on UNIX |
|||||||
#3
|
|||||||
|
|||||||
Re: combining truncate and replace
I was wondering if anyone knows if it is possible to truncate a string but to do it at the first "," instead of at a certain number of characters? For example
scented candles, votives, candle holders would be shown only as scented candles thanks
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3 mods: reCaptcha running on UNIX www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2 mods: reCaptcha cdseo pro running on UNIX |
|||||||
#4
|
|||||||||
|
|||||||||
Re: combining truncate and replace
You can create a custom Smarty modifier, e.g. like this:
1. create a new Smarty modifier plugin -> "include/templater/plugins/modifier.mymodifier.php" with the following content: PHP Code:
2. add further use something like: {$_meta_keywords|mymodifier}
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
|||
X-Cart forums © 2001-2020
|