Hi
I'm trying to swap all instances of:
<span class="gallery">
<img src="image1.jpg" alt="image1" />
<img src="image2.jpg" alt="image2" />
<img src="image3.jpg" alt="image3" />
<img src="image4.jpg" alt="image4" />
</span>
with another HTML tag altogether, keeping the content between the tags (in my example, the images), so that it becomes something like:
<div id="mycarousel">
<ul>
<li><img src="image1.jpg" alt="image1" /></li>
<li><img src="image2.jpg" alt="image2" /></li>
<li><img src="image3.jpg" alt="image3" /></li>
<li><img src="image4.jpg" alt="image4" /></li>
</ul>
</div>
So far, I've managed this:
$content = preg_replace('#<span[^>]*>(.*?)</span>#siU', "swapped", $content);
which replaces <span> tags, including their content and their ending tags with "swapped".
Unfortunately, I've only been able to get the CMS to output the initial code so I've run out of options, and now I need to use JQuery to turn the list of images into a carousel which is easy enough. It's not a solution I'm happy with, as ideally the CMS would output the correct code, but I've been working at this for hours now, and I'm on a tight deadline to get this out for a client.
Please, any help would be greatly appreciated.