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
https://forums.phpfreaks.com/topic/224067-open-linkimage-in-template-file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.