Forum Moderators: coopster

Message Too Old, No Replies

how do I dynamically include an image?

         

doozer77

6:07 pm on May 10, 2005 (gmt 0)

10+ Year Member



I'm building a very simply dynamic site with a template page in which the content in dynamically brought in:

template.php?content=home

However, I also want to bring in an image for each page and I have tried to use the "require" and "include" commands but what ends up happening is that instead of an image I get a bunch of computer machine code.

I would like a link to look like this:

template.php?content=home&image=home

How can I dynamically call in an image?

kazecoder

6:16 pm on May 10, 2005 (gmt 0)

10+ Year Member



If all your photos are in the same directory and are all the same type like .jpg or .gif you can do this:

Your Link: template.php?content=home&image=home

Call Image by using:

echo ("<img src=$image.jpg>");

doozer77

6:26 pm on May 10, 2005 (gmt 0)

10+ Year Member



thank you...it worked like a charm!