Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Use a config variable {#var#} inside smarty expression

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
mik3e
Smarty n00b


Joined: 20 Aug 2013
Posts: 4

PostPosted: Wed Sep 18, 2013 1:30 pm    Post subject: Use a config variable {#var#} inside smarty expression Reply with quote

Hi,

I´ve the need to use a config variable inside a smarty expression. In this example I´ve a regular expression where I want to add a language dependend text ({#new_address#}):

Code:
{$BUTTON_NEW|regex_replace:'/<a[^>]*href="([^"]*)"[^>]*>.*<\/a>/':'<a href="$1" class="btn btn-primary">#new_address#</a>'}


Can anyone give me a hint how to do that?

Thanks a lot,
Michael
Back to top
View user's profile Send private message
mik3e
Smarty n00b


Joined: 20 Aug 2013
Posts: 4

PostPosted: Wed Sep 18, 2013 1:58 pm    Post subject: Reply with quote

After some experiments I found the solution - maybe someone need it also:
Code:
{$BUTTON_NEW|regex_replace:'/<a[^>]*href="([^"]*)"[^>]*>.*<\/a>/':'<a href="$1" class="btn btn-primary">'|cat:$smarty.config.add_new_address|cat:'</a>'}
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP