|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
8ternity Smarty n00b
Joined: 27 Jan 2020 Posts: 2
|
Posted: Fri Jan 31, 2020 2:38 pm Post subject: Need help on regex_replace |
|
|
Hi,
I have a prestashop store and they use in List mode view a |strip_tags command which remove everything in the Description Summary.
All our products are created with <UL><LI></LI></UL> and i want to add a . before closing the</li>.
I've used |regex_replace to replace Return line and add an . before closing the </li>.
I have no experience on how regex_replace work. I've try so many things but does anyone can help me with that please?
The original code is :
Code: | {block name='product_description_short'}
<div class="product-description-short" itemprop="description">{$product.description_short|strip_tags:false}</div>
{/block}
|
I've try this :
Code: | {block name='product_description_short'}
<div class="product-description-short" itemprop="description">{$product.description_short|regex_replace:"[\n]":". "|strip_tags:false}</div>
{/block} |
Thanks. |
|
Back to top |
|
8ternity Smarty n00b
Joined: 27 Jan 2020 Posts: 2
|
Posted: Fri Jan 31, 2020 3:12 pm Post subject: |
|
|
I resolved it.
I was using that regex_replace :
Code: | {$product.description_short|regex_replace:"(<\/li>)":".</li>"|strip_tags:false} |
Glad it worked!
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|