😃
I did exactly that while I was waiting for a reply:
$ed_open = "[ed]";
if (strstr($data, $ed_open)) {
$ed_close = "[/ed]";
$data = str_replace($ed_open, '{|}', $data);
$data = str_replace($ed_close, '{||}', $data);
}
$foot_open = "[foot]";
if (strstr($data, $foot_open)) {
$foot_close = "[/foot]";
$data = str_replace($foot_open, '{|||}', $data);
$data = str_replace($foot_close, '{||||}', $data);
}
Then after the search $string has been parsed:
if (isset($ed_close)) {
$data = str_replace('{|}', '<p class="editor"><u><b>Editors Note:</b></u>', $data);
$data = str_replace('{||}', '</p>', $data);
}
if (isset($foot_close)) {
$data = str_replace('{|||}', '<p class="footnote"><u><b>Footnote:</b></u>', $data);
$data = str_replace('{||||}', '</p>', $data);
}
It works well, but I am suprised there isnt a function that inserts a string into a string at a certain position.
While we are in this thread, my next mission is to parse the [url="address.com]link text[/url] tags. I need to extract the $address and $link_text vars so I can use them in the link replacement code. The first thing that conerns me is that there could be more than one set of [url] tags in an article, I have been advised to look at how a fprum does this, so will do that for now, but if you have any pointers I would appreciate your expertise.
Thankyou again 😃