Forum Moderators: coopster
so like if my post is:
=====
Today I took a walk and I didn't see anything interesting at all. Here's a picture of me taking a walk:
[][]pic¦21[][]
=====
then php would automatically replace the last line with an image #21 from my database
try the str_replace() [uk2.php.net] function.
$data = str_replace("[][]pic¦21[][]", "images/picture21.jpg", $data);
dc
For example;
$data = preg_replace( "[][]pic¦([0-9]*)[][]", "<img src='images/picture\\1.jpg'>", $data );
The \\1 in the replacement string means use whatever was matched in the first bracketed element of the search string.
Note: square brackets may have to be escaped (preceeded with \) in the match string, i'm not sure.