|
Posted by Y.G. on 04/03/06 16:40
I am making a script which displays an RSS feed on my website. To do
this I would like to take all the <div class="blabla"><img src="bla.jpg"
alt="bla"> </div> tags and put them in front of my text. So the
following string:
<p>This is text blah blah blah</p>
<div class="blabla"><img src="bla.jpg" alt="bla"> </div>
<p>this is another text</p>
should give as output:
<div class="blabla"><img src="bla.jpg" alt="bla"> </div>
<p>This is text blah blah blah</p>
<p>this is another text</p>
I tried using regular expressions, but I do not really get it done. Here
is the code I use:
while(ereg('/<DIV class=\"blabla\"*>(.*?)<\/DIV>/i',$content, $matches)){
$img=$img.$matches[0];
$content=ereg_replace('/<DIV
class=\"imgbar50\"*>(.*?)<\/DIV>/i',"",$content,1);
}
what do i do wrong?
[Back to original message]
|