Jump to content

Open Link/Image in Template File


xenowing

Recommended Posts

I have a page with links to images. Currently the images open in a blank browser window, and I think this is too plain.

I don't want to create an HTML file for each image.

I want to have an 'image display php file' - img_temp.php.

Along with the reference to the image file, in the link, I want to also be able to send a <title> to the template file.

 

I think the code below shows kinda' what I'm trying to do, and also shows that I don't quite have a grasp on how to do it.

 

Any tips would be appreciated.

 

Index Page (index.php)

<html>
<head>
<title>Gallery Links</title>
</head>

<body>
<!-- This is the page with the links to the images -->
<ul>
  <li><a href="img_temp.php?file=images/01.jpg<?php ?title = "This is image 1"?>">Image 01</a></li>
</ul>
</body>
</html>

 

 

Image Display Template (img_temp.php)

<html>
<head>
<title><?php echo $title ?></title>
</head>
<body>
<!-- This is the page that displays the sent image and displays the appropriate doc title  -->
<?php
  //Output the image $file
  echo $file;
?>
</body>
</html>

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.