Hi all,
I'm having trouble trying to figure out the best approach to this
problem and I believe regular expressions are the way to go.
Basically I have created a large string of XHTML using a WYSIWYG editor,
so the string is like "<p>dfdsfjhds <img src='temp.jpg' />
dsfdsfsd</p><p>dfsdfsdfsd</p... "
What I want to do is the following...
When SAVING the string to the database I want to replace:
<img class="myImg" alt="" src="image.jpg" />
with...
<div class="cnt_myImg_left">
<div class="inner">
<img class="myImg" alt="" src="image.jpg" />
<p class="sub_text detail">my picture</p>
</div>
</div>
and when EDITING the string, I want to reinstate the original ....so
replace:
<div class="cnt_myImg_left">
<div class="inner">
<img class="myImg" alt="" src="image.jpg" />
<p class="sub_text detail">my picture</p>
</div>
</div>
with...
<img class="tmceImg" alt="" src="image.jpg" />
Does anyone know the best approach to this?
Many thanks!
Peter
--
fiddlewidawiddum