Jump to content

PHP Default Directory


whistl3r

Recommended Posts

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/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.