Hello
I'm using preg_replace to parse a bulletin board type tag [img] into a <img scr=""> tag. The format of the path to the image is something like 0200_0000_name.ext where the "02" changes depending on what directory the image is stored in. So I basically want 0200_0000_name.ext to become 02/02_00_0000_name.ext once parsed. I tried the following:
$pattern = "/[img(left|right)?](([<> \n]+?).(gif|jpg|jpeg|png))[\/img]/i";
$ImagePath = "\2";
$dir = explode("/", $ImagePath);
$ContentFolder = $dir[0];
$replacement = '<img src="content/images/$ContentFolder/\2" border="1" align="\1" alt="" hspace="10" vspace="b">';
$FormText = preg_replace($pattern, $replacement, $FormText);
But in only prints the var name "content/images/$ContentFolder/" not the value of $ContentFolder could some plese tell me how to achieve the correct result.
Many thanks in advance for any help given.
John