forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 modpack by Stramm => Topic started by: aldog on April 30, 2008, 02:10:00 am
-
With help from these topics
http://forum.coppermine-gallery.net/index.php/topic,26315.0.html
http://forum.coppermine-gallery.net/index.php/topic,12854.msg58480.html
http://forum.coppermine-gallery.net/index.php/topic,50236.msg241952.html
I've managed to get very close to having a favorites button in the navigation bar. But now I guess I've hit a wall and can't figure out how to get over it.
I'm using stramm's modpack with the oranje theme, but my navbar is mainly from the eyeball theme. I'm assuming that given that, my thread should go in this forum, if it should go in stramm's forum I apologize and would ask that a mod move it.
What I've Done:
In displayimage.php
after
// Display picture information
function html_picinfo()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR, $REFERER;
global $album, $lang_picinfo, $lang_display_image_php, $lang_byte_units, $lastup_date_fmt;
I added
global $FAVPICS ;//ajout pour icone favorits
In theme.php
After this
<!-- BEGIN ecard_button -->
<td align="center" valign="middle" class="navmenu" width="48">
<a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}"><img src="{LOCATION}images/newnav/ecard.gif" border="0" align="middle" alt="{ECARD_TITLE}" /></a>
</td>
<!-- END ecard_button -->
I've added this code
<!-- DEBUT lien vers les favorits (ajout FRANTZ) -->
<td align="center" valign="middle" class="navmenu" width="48">
<a href="{FAV_TGT}" class="navmenu_pic" title="{FAV_TITLE}"><img src="{LOCATION}images/newnav/fav.gif" border="0" align="middle" alt="{FAV_TITLE}" /></a>
</td>
<!-- FIN Lien favorits (ajout FRANTZ) -->
At the end of the theme.php, before ?> I put this
function theme_html_img_nav_menu()
{
global $CONFIG, $CURRENT_PIC_DATA, $meta_nav, $THEME_DIR ; //$PHP_SELF,
global $album, $cat, $pos, $pic_count, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;
global $lang_picinfo, $FAVPICS ;//ajout pour icone favorits
$cat_link = is_numeric($album) ? '' : '&cat=' . $cat;
$uid_link = is_numeric($_GET['uid']) ? '&uid=' . $_GET['uid'] : '';
$human_pos = $pos + 1;
$page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols']));
$pid = $CURRENT_PIC_DATA['pid'];
$start = 0;
$start_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$start";
$start_title = $lang_img_nav_bar['go_album_start'];
$meta_nav .= "<link rel=\"start\" href=\"$start_tgt\" title=\"$start_title\" />
";
$end = $pic_count - 1;
$end_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$end";
$end_title = $lang_img_nav_bar['go_album_end'];
$meta_nav .= "<link rel=\"last\" href=\"$end_tgt\" title=\"$end_title\" />
";
if ($pos > 0) {
$prev = $pos - 1;
$prev_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$prev$uid_link";
$prev_title = $lang_img_nav_bar['prev_title'];
$meta_nav .= "<link rel=\"prev\" href=\"$prev_tgt\" title=\"$prev_title\" />
";
} else {
$prev_tgt = "javascript:;";
$prev_title = "";
}
if ($pos < ($pic_count -1)) {
$next = $pos + 1;
$next_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$next$uid_link";
$next_title = $lang_img_nav_bar['next_title'];
$meta_nav .= "<link rel=\"next\" href=\"$next_tgt\" title=\"$next_title\"/>
";
} else {
$next_tgt = "javascript:;";
$next_title = "";
}
if (USER_CAN_SEND_ECARDS) {
$ecard_tgt = "ecard.php?album=$album$cat_link&pid=$pid&pos=$pos";
$ecard_title = $lang_img_nav_bar['ecard_title'];
} else {
template_extract_block($template_img_navbar, 'ecard_button'); // added to remove button if cannot send ecard
/*$ecard_tgt = "javascript:alert('" . addslashes($lang_img_nav_bar['ecard_disabled_msg']) . "');";
$ecard_title = $lang_img_nav_bar['ecard_disabled'];*/
}
//report to moderator buttons
if (($CONFIG['report_post']==1) && (USER_CAN_SEND_ECARDS)) {
$report_tgt = "report_file.php?album=$album$cat_link&pid=$pid&pos=$pos";
} else { // remove button if report toggle is off
template_extract_block($template_img_navbar, 'report_file_button');
}
$thumb_tgt = "thumbnails.php?album=$album$cat_link&page=$page$uid_link";
$meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']."\"/>
";
$slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link$uid_link&pid=$pid&slideshow=".$CONFIG['slideshow_interval'];
$pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count);
if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
$location= $THEME_DIR;
} else {
$location= '';
}
//ajout pour lien vers favorits (Frantz)
// Create the add to fav link
if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
$fav_tgt = "addfav.php?album=$album$cat_link&pid=$pid&pos=$pos";
$fav_title = $lang_picinfo['addFav'];
} else {
$fav_tgt = "addfav.php?album=$album$cat_link&pid=$pid&pos=$pos";
$fav_title = $lang_picinfo['remFav'];
}
//fin ajout
$params = array('{THUMB_TGT}' => $thumb_tgt,
'{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'],
'{PIC_INFO_TITLE}' => $lang_img_nav_bar['pic_info_title'],
'{SLIDESHOW_TGT}' => $slideshow_tgt,
'{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'],
'{PIC_POS}' => $pic_pos,
'{ECARD_TGT}' => $ecard_tgt,
'{ECARD_TITLE}' => $ecard_title,
'{PREV_TGT}' => $prev_tgt,
'{PREV_TITLE}' => $prev_title,
'{NEXT_TGT}' => $next_tgt,
'{NEXT_TITLE}' => $next_title,
'{PREV_IMAGE}' => ($lang_text_dir=='ltr') ? 'prev' : 'next',
'{NEXT_IMAGE}' => ($lang_text_dir=='ltr') ? 'next' : 'prev',
'{REPORT_TGT}' => $report_tgt,
'{REPORT_TITLE}' => $lang_img_nav_bar['report_title'],
'{LOCATION}' => $location,
'{FAV_TGT}' => $fav_tgt,//ajout Frantz
'{FAV_TITLE}' => $fav_title,//ajout Frantz
);
return template_eval($template_img_navbar, $params);
}
My Problem:
After adding the previous snippet to the end of my theme.php, the favorites button works (woohoo) but the picture title, the owner name, and the owner ID do not anymore, they now navigate to http://ad6storieshigh.com/gallery/{OWNER_NAME} respectively
So I'm guessing the solution (even if it's not pretty) would be to remove everything from the "function theme_html_img_nav_menu()" that I don't need, I've tried to do this but haven't been able to accomplish it yet, either I don't remove enough, or I remove too much
My Gallery http://ad6storieshigh.com/gallery/displayimage.php?pos=-642
my theme.php is attached as well.
-
You need to copy in the modpack's version of theme_html_img_nav_menu() not the the stock version. I think you need to copy from include/themes.inc.php and then apply your modifications to the new copy.
-
You need to copy in the modpack's version of theme_html_img_nav_menu() not the the stock version. I think you need to copy from include/themes.inc.php and then apply your modifications to the new copy.
Yes, thanks Nibbler!
-
aaahhh yes perfect! my favorites button is working great now!
http://ad6storieshigh.com/gallery/displayimage.php?pos=-476
And just to help anyone out that wants the same...a full explanation.
(I'm using stramm's modpack, oranje theme, but my navbar is taken from eyeball and modified slightly)
1st - Add a image fav.gif into your themes/images/ folder (mine is located in themes/images/newnav/ just so I can edit those files and leave stramm's alone)
2nd - In themes/yourtheme/theme.php
AFTER
<!-- BEGIN ecard_button -->
<td align="center" valign="middle" class="navmenu" width="48">
<a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}"><img src="{LOCATION}images/ecard.gif" border="0" align="middle" alt="{ECARD_TITLE}" /></a>
</td>
<!-- END ecard_button -->
ADD
<!-- DEBUT lien vers les favorits (ajout FRANTZ) -->
<td align="center" valign="middle" class="navmenu" width="48">
<a href="{FAV_TGT}" class="navmenu_pic" title="{FAV_TITLE}"><img src="{LOCATION}images/fav.gif" border="0" align="middle" alt="{FAV_TITLE}" /></a>
</td>
<!-- FIN Lien favorits (ajout FRANTZ) -->
3rd - Open include/themes.inc.php (this code might already be in your themes/yourtheme/theme.php, if so skip to step 4)
Copy the whole function..
function theme_html_img_nav_menu()
Paste it into THEMES.PHP right before
?>
Close themes.inc.php, don't edit it or save changes to it.
4th - In function theme_html_img_nav_menu()
After
global $album, $cat, $pos, $pic_count, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;
Add
global $lang_picinfo, $FAVPICS ;//ajout pour icone favorits
After
$CONFIG['slideshow_interval'];
$pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count);
if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
$location= $THEME_DIR;
} else {
$location= '';
}
Add
//ajout pour lien vers favorits (Frantz)
// Create the add to fav link
if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
$fav_tgt = "addfav.php?album=$album$cat_link&pid=$pid&pos=$pos";
$fav_title = $lang_picinfo['addFav'];
} else {
$fav_tgt = "addfav.php?album=$album$cat_link&pid=$pid&pos=$pos";
$fav_title = $lang_picinfo['remFav'];
}
//fin ajout
close theme.php (save of course)
5th - In (galleryroot)/displayimage.php
AFTER
// Display picture information
function html_picinfo()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR, $REFERER;
global $album, $lang_picinfo, $lang_display_image_php, $lang_byte_units, $lastup_date_fmt;
ADD
global $FAVPICS ;//ajout pour icone favorits
Thanks Nibbler and stramm.
all credit goes to the people in the threads mentioned in my first post
-
Thanks. Works well.
But you missed to tell to add the following code.
'{FAV_TGT}' => $fav_tgt,//ajout Frantz
'{FAV_TITLE}' => $fav_title,//ajout Frantz
See above your first post.
regards, Dietmar
-
I can't tell by my posts if that bit of code is needed. Did you try it without that? if so what was the result/error?
I'll edit it into my post if it is needed, just let me know
-
I can't tell by my posts if that bit of code is needed. Did you try it without that? if so what was the result/error?
I'll edit it into my post if it is needed, just let me know
This bit:
'{FAV_TGT}' => $fav_tgt,//ajout Frantz
'{FAV_TITLE}' => $fav_title,//ajout Frantz
needs to be added to function theme_html_img_nav_menu right before:
);
return template_eval($template_img_navbar, $params);
}
Otherwise, instead of "Add to favorites", you just get "{FAV_TITLE}" and a broken link.
Also, (and I apologize if I'm stating the obvious, but being a newbie it took me a little time to figure out), before doing any of this you need to copy the section
// HTML template for the image navigation bar
$template_img_navbar = <<<EOT
(( etc etc copy the whole thing up to EOT ))
EOT;
from themes.inc.php to theme.php .
Thanks for this excellent mod. ;D