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

Block function to replace multiple %string with text

 
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
doge
Smarty n00b


Joined: 03 Dec 2019
Posts: 3

PostPosted: Wed Dec 04, 2019 5:22 am    Post subject: Block function to replace multiple %string with text Reply with quote

I created a block function code but it is doesn't work, here is the code

Code:
function smarty_block_t($params, $string, &$smarty) {
   foreach($params as $key => $value) {
      $params["%$key"] = $value;
      unset($params[$key]);
   }
}



The function is to replace a string with '%' tag into its text, for example

Code:
{t sitename=http://smarty.com}%sitename is a cool web{t}


OR

Code:
{t sitename=smart siteurl=http://smarty.com}%sitename is a cool web at %siteurl{t}


Can someone help me figure it out?
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