![]() |
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:
{$_meta_keywords|truncate:"130":"":false|escape} 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:
{$_meta_keywords|replace:",":""|truncate:"130":"":false|escape} Anyone know how to do that? |
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:
{$_meta_keywords|truncate:"100":"":false|replace:',':''|escape} 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. |
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 |
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} |
All times are GMT -8. The time now is 12:55 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.