在php中的灯箱效果问题

I am using lightbox to show an image in php.

My current code:

<a class="sri" href="administrator/all_photo/mywork/
<?php 
    echo $res['path'];
?>
_1.jpg" rel="lightbox">
<img src="administrator/all_photo/mywork/
<?php 
    echo $res['path'];
?>
_1.jpg" class="photo_frame photo_size" >
<br />
<?php 
    echo $res['title'];
?>
</a>

CSS and JS for lightbox have already been included. In the above code, $res['title'] and $res['path'] are being fetched from database.

If I click on the image or the text which is showing as $res['title'], lightbox effect is showing. The image is within the lightbox. Now I need the $res['title'] value also be displayed when the lightbox is opened along with the image.

How do I do that?

Just use the title parameter in the <a> tag, as mentionned in the Lightbox Documentation:

Optional: Use the title attribute if you want to show a caption.

You should be able to move all of your markup into a div. Add rel="lightbox" to that div, it should work. Although that depends on the lightbox library you are using.

You must add the title:

<a class="sri" href="administrator/all_photo/mywork/
<?php 
    echo $res['path'];
?>
_1.jpg" rel="lightbox">
<img src="administrator/all_photo/mywork/
<?php 
    echo $res['path'];
?>
_1.jpg" title="
<?php 
    echo $res['title'];
?>
" class="photo_frame photo_size" >
</a>