Hi guys! I was wondering if someone could point me in the right direction on how to replace a short tag like {img} with <img src="http://website.com/img/img.png" title="image"> using PHP?
replace {tag} with html?
(3 posts) (2 voices)-
Posted 7 months ago #
-
The easiest way would be to use a simple search-replace function. For example:
<?php $content = 'Hello world. {img} This is a picture of my house.'; $src = 'http://example.com/house.jpg'; $content = str_replace( '{img}', '<img src="' . $src . '" title="image">', $content ); echo $content; ?>Posted 7 months ago # -
Awesome! Thank you. :)
Posted 6 months ago #
Reply
You must log in to post.