Copy link to clipboard
Copied
Hi,
I hope somebody can help me with this.
I try to replace a string in the body of a php page to automaticaly insert rel='lightbox[serie] to make lightbox work while inserting photos within TinyMCE.
I created this code in the head section but it doesnot work:
<?php $imagetag = str_replace("<img", "<img rel='lightbox[serie]'", "<body>"); ?>
Where do I go wrong?
Your help is appreciated.
Jos
Copy link to clipboard
Copied
str_replace takes 3 mandatory parameters
search = the string your are search for = "<img"
replace = the string you want to replace it with = "<img rel='lightbox[serie]'"
subject = the string or array you want to search = "<body>"
For subject, you are using a hard coded string which does not make sense because the string "<body>" does not contain the string "<img". You need to supply a string variable that contains the string you are searching for.
Copy link to clipboard
Copied
Thanks for reaction. I will let you know if I succeed.