Smarty string replace

I am trying to replace part of a string that is within a smarty template. Any text before and including a semicolon with nothing.

Example string
“Name: Info”

Any help would be appreciated.

$string = trim(strstr(':', $string));

Yes, but is this possible to do to a variable inside of a Smarty template?

{$string|replace:‘Name: ‘:’’}

You can also overload smarty with your own modifiers which can be a very powerful solution.

Also when inside a Smarty template it is possible to move into php using {php} tags.

$this->assign(‘string’,str_replace($this->get_template_vars(‘string’),‘Name: ‘,’’));


You can than get the variable your after using get_template_vars() method and reassign it directly to the template before printing it.

“Name:” however changes… Name is a variable that ends with :. Trying to remove the Name and :

I decided to just modify the php.

trim(substr(strstr($name, ‘:’),1));