req: display_image code change (cosmetic) req: display_image code change (cosmetic)
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

req: display_image code change (cosmetic)

Started by eke, November 28, 2003, 05:01:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

eke

i tried to add album and thumb title to the title tag in the popup window view but somehow it didnt work:

file: displayimage.php
change: popup window title tag

original:
<title><?php echo $CONFIG['gallery_name'&#93;;?>: <?php echo $lang_fullsize_popup['click_to_close'&#93;;
    
?>
</title>


changed to:
<title><?php echo $CONFIG['gallery_name'&#93;;?> &raquo; <?php echo $CURRENT_PIC_DATA['album'&#93;;?> &raquo; <?php echo $CURRENT_PIC_DATA['title'&#93;;?> - <?php echo $lang_fullsize_popup['click_to_close'&#93;;
    
?>
</title>


I guess it's the $CURRENT_PIC variable being not available inside that function? any help appreciated, thanks

eke.

EZ

eke,

The array items that you try to access are not visible inside the function. In order to make them visible you have to add the array variable to the global statement at the beginning of the function (a few lines above the line you've changed). Eg.:global $CONFIG, $HTTP_GET_VARS, $THEME_DIR, $ALBUM_SET, $CURRENT_PIC_DATA;
I didn't test but my guess is that your code will work after this change.

Eyal.

eke

yeah i tried that already but it did not work. either the [var] names are wrong or I am missing something else.

i'll have to buy myself a php book...

EZ

Try to insert this in the code:echo("\n<!-- \n");
print_r($CURRENT_PIC_DATA);
echo("\n -->\n");

This should dump the entire contetnts of $CURRENT_PIC_DATA array as a comment in the HTML source, so you'll know for sure what it contains.

Also verify that you spell variable/array names exactly - PHP doesn't warn when you access a variable that hasn't been assigned a value before (actually in such case PHP creates a new variable with an empty or zero value).

And finally, if you have some programming experience then you don't need to buy a book, you only need the PHP docs (available as HTML or Windows help file). If you do need an easier introduction to PHP and programming, try one of Oreilly books - their books are good and they're strong supporters of open source.

Eyal.

eke

i tried the echo on all vars in that global statement:

    global $CONFIG, $HTTP_GET_VARS, $THEME_DIR, $ALBUM_SET, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA;


and the only ones returning any value were the first three. album_set (which is originally there) current_pic_data and current_album_data where empty.

maybe the function display_fullsize_pic() has to be called differently to actually be able to process these vars or maybe an sql query needs to be placed with the "pid" from http_get_vars ?

i have downloaded the phpself docs and will delve into this. i have done some programming in delphi and java ages ago...

eke.