Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Use a config variable {#var#} inside smarty expression

 
Post new topic   Reply to topic    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,

Ive the need to use a config variable inside a smarty expression. In this example Ive 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:   
Post new topic   Reply to topic    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