Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Block function to replace multiple %string with text

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