...

View Full Version : Dynamically inserting directory name into a file name?



Errica
12-10-2008, 12:58 AM
On the following url, as an example:

http://www.mydomain.com/services/Graphic_Design/

How can I have the code for a favicon pull from the directory name so that the code is:

<link rel="shortcut icon" type="image/x-icon" href="/favicon_Graphic_Design.gif">

Thanks,
Errica

Errica
12-10-2008, 01:21 AM
OK, it seems I have this working with the following:


<?php
function dir_name(){
$get = explode('/', dirname($_SERVER['PHP_SELF']));
return end($get);
}
?>

<?php echo dir_name(); ?>

If there's a better recommendation, let me know? Thanks!
Errica

abduraooft
12-10-2008, 07:39 AM
Check http://php.net/manual/en/function.dirname.php#82002



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum