12-22-2009, 12:00 AM
|
#1 (permalink)
|
|
The Contributor
Join Date: Jan 2009
Posts: 48
Thanks: 5
|
Using preg_replace to write image html with lightbox?
A year or so ago I used preg_replace to grab some html for an image and rewrite it so it would have 'rel="lightbox"' in it to use lightbox. But I cant remember how to write it.
How would I write it to grab each <img /> tag to just include 'rel="lightbox"'after the src="".
basically transforming each...
Code:
<img src="urladdress" />
into this...
Code:
<img src="urladdress" rel="lightbox" />
I read the php.net page on preg_replace but I didn't understand.
Any help is appreciated!
|
|
|
|