whistl3r Posted August 17, 2007 Share Posted August 17, 2007 Howdy all, I have an issue with a site that I'm currently working with. Currently, my production page is running a php header/footer and works great, but a lack of content management. So, I decided to look for CMS, currently working with WordPress, soon to move to Movable Type, if I can't get this resolved. What I'm attempting to do is create a default directory for images. I would like the php script within the header to look for the directory then display those images represented in the img tags on the php files. Currently I have to place a php function on each individual img tag for WordPress to display them ( e.g. "<?php bloginfo('stylesheet_directory'); ?>/img/name.jpg" ). It's very time consuming, besides that WordPress is very flaky. If it's possible, I assume it is, I am looking for a script that would similarly do the following. <head> <?php imgsrc('path'); ?> <then img src ="<?php imgsrc('path'); ?>/img/name.jpg"> </head> Hope you understand the request. Example of the WordPress page shown below. Images do no display correctly *at all* the index is ok, but if you navigate away from the page the images will no longer display... http://kayakfrenzy.com/test2/ Quote Link to comment https://forums.phpfreaks.com/topic/65462-php-default-directory/ Share on other sites More sharing options...
php_tom Posted August 18, 2007 Share Posted August 18, 2007 How about this: in your header function, <?php $imgdir = "../The/Directory/Where/Your/Images/Are"; // or $imgdir = imgsrc('path'); ?> Note that you only need this once per page... Then for the image tags: <img src="<?php echo $imgdir; ?>/img/name.jpg" /> Not sure if this is what you had in mind. Hope it helps. Quote Link to comment https://forums.phpfreaks.com/topic/65462-php-default-directory/#findComment-327458 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.