0

I'm trying to replace a String with another in php on my forum. I am using Invision Community engine, so I don't know if there is a point in asking a question here, but maybe someone will help me.

I have a notification, e.g. I'd like to replace string, lets say I'd like to change commented to reacted, but after using str_replace("commented", "reacted", $title); it doesn't do anything. I tried to use str_replace("a","b",$title); and this happened.

{{$title = $notification['data']['title'];}}
{{$title = str_replace("commented", "reacted", $title);}}
<span class='ipsDataItem_title ipsType_break'>{$title}</span>
Havooc
  • 1
  • 1
  • It's been a loooong time since I've touched Invision, but there is an output plugin called "expression" that allows you to run arbitrary PHP expressions on templates and render the output. Try getting rid of the two {{$title}} lines and just replace {$title} with {expression="str_replace('commented', 'reacted', $notification['data']['title'])"} – Rob Ruchte May 14 '21 at 19:05
  • @RobRuchte unfortunately same result – Havooc May 15 '21 at 15:31

0 Answers0