Displaying my image link in its own tempalte and not in browser

Hi all of you good peeps,
As it is now my code displays the image in the browser. I would like to display my image in a template. Where should I point my “href” attribute?? See my code below

<?php if(count($files) > 0) : ?>
<?php foreach($files as $f) : ?>
<div>
<a href=“?action=view&id=<?php htmlout($f[‘id’]);?>”>// I wish to display the image in a template here
<img src=“?action=view&id=<?php htmlout($f[‘id’]);?>” border=“0” width=“90”/>
</a>
</div>
<?php endforeach; ?>
<?php endif;?>

No idea what you mean by a template.

I mean in it’s own html(a template is a file that contains both html and php)

I mean in its own html file. A template is a file that contains both html and php code. As it is now the image is only displayed in the browser and I’m unable to add any text attached to the image.

If you have a page say display.php and the link to this page would be <a href=display.php?photo=1.jpg"> you could get the photo name from the URL using $_GET[‘photo’]; and then display the photo on the page. Is this the sort of thing you want to do? But where will the text come from?

Chief,
Yes, this is exactly the thing I want to happen. I will be fetching the text from a text field in my text table or I could add the text myself manually - the important thing for me right now is that the functionality works. I’m in a harry to a meeting and will try your “hack” sometime today and let you know. Here is my code that didn’t work


<?php if(count($files) > 0) : ?>
<?php foreach($files as $f) : ?>
<div>
<a href=“?action=view&id=<?php htmlout($f[‘id’]);?>”>// I wish to display image in a template here
<img src=“?action=view&id=<?php htmlout($f[‘id’]);?>” border=“0” width=“90”/>
</a>
</div>
<?php endforeach; ?>
<?php endif;?>

This is what I would do:

On the main page you are linking from


<a href="display.php?ref=1">Link</a>

A page called display.php


<?php
/*** Connect to the database ***/
include 'connect.php';

$referance = $_GET['ref'];

// Select the photo details from the database
$result = mysql_query("
SELECT * FROM photos
WHERE ( ID = '$referance' )"
or exit ( mysql_error() );

$row = mysql_fetch_array( $result );

$photo = $row["photo"];

$size = getimagesize($photo);

echo "<img src=\\"$photo\\" ".$size[3]."\\">";

echo "<p>".$row["photo"]."</p>";
?>