Jump to content

Oberti

New Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Oberti

  • Rank
    Newbie
  1. I'm using preg_replace for adding a text below images (my regex is here) /<img.+?>/i It's fine when the img is alone, it gets converted from <img src="image.jpg" border="0" alt="" /> to: <img src="image.jpg" border="0" alt="" /> <br /> Text added here However sometimes the image is contained on a link <a href="http://www.google.com/"><img src="image.jpg" border="0" alt="" /></a> So the text in this case is placed inside the <a href, which is not what i want <a href="http://www.google.com/"><img src="image.jpg" border="0" alt="" /> <br /> Text added here</a> I need to achieve something like this with regexes, but i'm not sure how can i do this. if(<img src="image.jpg" border="0" alt="" />) { echo '<br /> Text here'; } else if(<a href="http://www.google.com/"><img src="image.jpg" border="0" alt="" /></a>) { echo '<br /> Text here'; } Thanks for the help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.