I'm working on an email template system where my client will go to a page and copy & paste the source code into their crm system.
I'm trying to find a way to automatically replace the image path without the use of echo if possible.
I've figured this out already with this script:
<?
function GetFileDir($php_self){
$filename = explode("/", $php_self); // THIS WILL BREAK DOWN THE PATH INTO AN ARRAY
for( $i = 0; $i < (count($filename) - 1); ++$i ) {
$filename2 .= $filename[$i].'/';
}
return $filename2;
}
?>
But I don't wanna have to go in and put
<?php echo GetFileDir("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>
before all the image paths.
So basically anywhere that src="images/whatever.jpg" is listed it will replace "images/" with "http://www.mydomain.com/images/whatever.jpg"
is it possible to do this without having to place code before "images" ?