str_replace or ereg_replace and image maps
Posted on 2006-03-28
I'm storing the html for many image maps in a mysql database, when the html is loaded I want to extend the urls for the area href's. Each image map will include several href's, each with a ref eg href="29". What I need to do when the html is loaded is extend the href to eg:
href="' . tep_href_link(FILENAME_DEFAULT, $cPath . '_29') . '"
where tep_href_link is a function and FILENAME_DEFAULT and $cPath are parameters.
The nearest I can get is:
$imagemap = str_replace('href="29"', 'href="' . tep_href_link(FILENAME_DEFAULT, $cPath . '_' . '29') . '"', $imagemap);
But '29' will be a value which differs for each area of the image map. Would ereg_replace solve the problem?