OK guys, here's what i did. I create a file, named it cpgtitler.php and put this inside.
<?php
$usr = "'s Gallery";
if($album==lastup) $ttrail="| Last Uploads";
elseif($album==lastcom) $ttrail="| Last Comments";
elseif($album==topn) $ttrail="| Top Viewed";
elseif($album==toprated) $ttrail="| Top Rated";
elseif($album==search) $ttrail="| Search Results";
elseif($album==random) $ttrail="| Random Picture";
if($file==thumbnails) { //filename thumbnail
if(is_numeric($album)) {
$sql = "SELECT title FROM cpg_albums WHERE aid='$album'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
$pagetitle = "| Gallery | View Album | $albumname";
} else { //meta album
if($cat) { //have category
if($cat<0) {
$sql = "SELECT title FROM cpg_albums WHERE aid='".(-$cat)."'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
} elseif($cat<10000) {
$sql = "SELECT namee FROM cpg_categories WHERE cid='$cat'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[namee];
} else {
$sql = "SELECT username FROM ".$prefix."_users WHERE user_id='".($cat-10000)."'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row['username'];
$albumname = "$albumname$usr";
}
$pagetitle = "| Gallery | $albumname $ttrail";
} else { //no category
$pagetitle = "| Gallery $ttrail";
if($search) $pagetitle = "| Gallery $ttrail: $search";
}
} // end album selection
} elseif($file==displayimage) { //filename displayimage
if(is_numeric($album)) {
$sql = "SELECT title FROM cpg_albums WHERE aid='$album'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
if($slideshow) {
$pagetitle = "| Gallery | $albumname | Viewing Slideshow";
} else {
$pagetitle = "| Gallery | $albumname | Viewing Picture";
}
} else { //meta album
if($pos<0) {
$sql = "SELECT filename, title FROM cpg_pictures WHERE pid='".(-$pos)."'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pictitle = $row[title];
$picfilename = $row[filename];
if(!$pictitle) {
$pagetitle = "| Gallery $ttrail | $picfilename";
} else {
$pagetitle = "| Gallery $ttrail | $pictitle";
}
} else { //positive pos
if($cat) {
if($cat<0) {
$sql = "SELECT title FROM cpg_albums WHERE aid='".(-$cat)."'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
$pagetitle = "| Gallery | $albumname $ttrail | Viewing Picture";
}
} else {
$pagetitle = "| Gallery $ttrail | Viewing Picture";
}
}
}
} elseif($file==search) {
$pagetitle = "| Gallery | Picture Search";
} elseif($file==upload) {
$pagetitle = "| Gallery | Picture Upload";
} else {
if($cat) { //have category
if($cat<0) {
$sql = "SELECT title FROM cpg_albums WHERE aid='".(-$cat)."'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
} elseif($cat<10000) {
$sql = "SELECT namee FROM cpg_categories WHERE cid='$cat'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[namee];
} else {
$sql = "SELECT username FROM ".$prefix."_users WHERE user_id='".($cat-10000)."'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row['username'];
$albumname = "$albumname$usr";
}
$pagetitle = "| Gallery | $albumname $ttrail";
} else { //no category
$pagetitle = "| Picture Gallery";
}
}
?>
I upload it to my coppermine folder and then replace this line
$pagetitle = "- Coppermine";
with
include("modules/coppermine/cpgtitler.php");
inside some files such as index.php, upload.php, displayimage.php, search.php and thumbnails.php.
It works fine for me, but I think it needs lots of fixes and improvements.
For example the default/user sort prevented me to display the picture title/filename. My code can only display it if you click the image from the random page. I know the Dev. Team will solve this in a just a few seconds,.
So pleeeeeaaaase help me improve it and if possible put it in the future release. :oops:
Wow! I never thought my post could be this long. Sorry... :oops:
Just to let you know. The code above is based on a hack inside tha file nukebb.php (BBToNuke 2.0.5?). below is the credit line inside that file:
// The following code block inserts forum thread titles in the html title bar
// The code was supplied by members at nuke cops: http://www.nukecops.com/postt4466.html
// With special thanks to Curt and georgiaguy for this forums hack.
I am not the original author, I only make it to work with Coppermine 1.1D.
Those guys deserved the credits.
The basic idea might be theirs but the codes all yours :D I am working to include the language variables and will include this as a option in CPG 1.2nuke
Cool!
Here is my code for the CPG nice titles thing, there are a couple of bugs (no $picname or $pictitle displayed) but this should work in 1.1d otherwise...
If someone can can hack the sql statement$sql = "SELECT filename, title FROM cpg_pictures WHERE pid=$pid";
that controls that to make this code work correctly I'll give you 3 :idea: :idea: :idea: brownie points :P but really i'm sure it can be done with an inner or left join but right now it escapes me!
I took all the English out of the display except for the few variables in lang_pagetitle_php which will be added to the language files in the final version. I used the table name nuke_users for readabilty so change that is that's not the name of your table
<?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.2.0 nuke DEVEL //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002,2003 Gregory DEMAR <gdemar@wanadoo.fr> //
// http://www.chezgreg.net/coppermine/ //
// ------------------------------------------------------------------------- //
// Updated by gtroll //
// (http://coppermine.sf.net/team/) //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// ------------------------------------------------------------------------- //
// define language array
$lang_pagetitle_php = array('divider' => '>',
'viewing' => 'Viewing Photo',
'usr' => "'s Photo Gallery",
'photogallery' => 'Photo Gallery',
);
// Process language selection
global $currentlang, $language;
if (file_exists("modules/coppermine/lang/$currentlang.php")) {
$USER['lang'] = $currentlang;
} else {
$USER['lang'] = $language;
}
if (!file_exists("modules/coppermine/lang/{$USER['lang']}.php")) {
if (!file_exists("modules/coppermine/lang/{$CONFIG['lang']}.php")) {
$CONFIG['lang'] = 'english';
}
} else {
$CONFIG['lang'] = $USER['lang'];
}
include "modules/coppermine/lang/{$CONFIG['lang']}.php"; //sengsara
// define variables
$pos = isset($HTTP_GET_VARS[pos]) ? (int)$HTTP_GET_VARS[pos] : 0;
$humanpos = $pos + 1;
$cat = isset($HTTP_GET_VARS[cat]) ? (int)$HTTP_GET_VARS[cat] : 0;
$album = isset($HTTP_GET_VARS[album]) ? $HTTP_GET_VARS[album] : '';
$file = isset($HTTP_GET_VARS[file]) ? $HTTP_GET_VARS[file] : '';
switch ($album) {
case 'lastup':
$ttrail = "$lang_pagetitle_php[divider] $lang_meta_album_names[lastup] "; //Last Uploads
break;
case 'lastcom':
$ttrail = "$lang_pagetitle_php[divider] $lang_meta_album_names[lastcom] "; //Last Comments
break;
case 'topn':
$ttrail = "$lang_pagetitle_php[divider] $lang_meta_album_names[topn] "; //Top Viewed
break;
case 'toprated':
$ttrail = "$lang_pagetitle_php[divider] $lang_meta_album_names[toprated] "; //Top Rated
break;
case 'search':
$ttrail = "$lang_pagetitle_php[divider] $lang_meta_album_names[search] "; //Search Results';
break;
case 'random':
$ttrail = "$lang_pagetitle_php[divider] $lang_meta_album_names[random] "; //Random Picture
break;
default:
$ttrail = '';
break;
} //end sorted galleries
switch ($file) {
case 'thumbnails': // filename thumbnail
if (is_numeric($album)) { //regular album
$sql = "SELECT title FROM cpg_albums WHERE aid='$album'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
$pagetitle = "$lang_pagetitle_php[photogallery] $lang_pagetitle_php[divider] $albumname $ttrail";
} else { // meta album
if (isset($HTTP_GET_VARS['cat']) && $HTTP_GET_VARS['cat'] != 0) { // have category
if ($cat < 0) {
$sql = "SELECT title FROM cpg_albums WHERE aid='" . (- $HTTP_GET_VARS[cat]) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
} elseif ($cat < 10000) {
$sql = "SELECT owner_id FROM cpg_categories WHERE cid='$cat'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[owner_id];
} else {
$sql = "SELECT username FROM nuke_users WHERE user_id='" . ($cat-10000) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row['username'];
$albumname = "$albumname$lang_pagetitle_php[usr]";
}
} else {
$pagetitle = "$lang_cat_list[pictures] $ttrail";
if ($HTTP_GET_VARS[search]) $pagetitle = "$lang_cat_list[pictures] $ttrail: $search";
}
} // end album selection
break;
case 'displayimage': // filename displayimage
if (is_numeric($album)) { // regular album
$sql = "SELECT title FROM cpg_albums WHERE aid='$album'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
if ($slideshow) {
$pagetitle = "$albumname $lang_pagetitle_php[photogallery] Slideshow";
} else { // Viewing Normal Picture
$sql = "SELECT filename, title FROM cpg_pictures WHERE pid=$pid";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pictitle = $row[title];
$picfilename = $row[filename];
$humanpos = $pos + 1;
if ($pictitle != '') {
$pagetitle = "$albumname $lang_pagetitle_php[divider] $lang_pagetitle_php[viewing] $lang_pagetitle_php[divider] $pictitle $ttrail";
} elseif ($picname != '') {
$pagetitle = "$albumname $lang_pagetitle_php[divider] $lang_pagetitle_php[viewing] $lang_pagetitle_php[divider] $picname $ttrail";
} else {
$pagetitle = "$albumname $lang_pagetitle_php[divider] $lang_pagetitle_php[viewing] $lang_pagetitle_php[divider] $humanpos $ttrail";
}
}
} else { // meta album
if ($pos < 0) { // neg pos
$sql = "SELECT filename, title FROM cpg_pictures WHERE pid='" . (- $pos) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pictitle = $row[title];
$picfilename = $row[filename];
$humanpos = $pos + 1;
if ($pictitle != '') {
$pagetitle = "$albumname $lang_pagetitle_php[divider] $lang_pagetitle_php[viewing] $lang_pagetitle_php[divider] $pictitle $ttrail";
} elseif ($picname != '') {
$pagetitle = "$albumname $lang_pagetitle_php[divider] $lang_pagetitle_php[viewing] $lang_pagetitle_php[divider] $picname $ttrail";
} else {
$pagetitle = "$albumname $lang_pagetitle_php[divider] $lang_pagetitle_php[viewing] $lang_pagetitle_php[divider] $humanpos $ttrail";
} //end neg pos
} else { // positive pos
if ($cat) {
if ($cat < 0) { // if less 0
$sql = "SELECT title FROM cpg_albums WHERE aid='" . (- $cat) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
$pagetitle = "$albumname $ttrail $lang_pagetitle_php[divider] $lang_pagetitle_php[viewing] $humanpos $ttrail";
}
} else {
$pagetitle = "$lang_pagetitle_php[photogallery] $ttrail $lang_pagetitle_php[divider] $lang_pagetitle_php[viewing] $humanpos $ttrail";
}
} // end positive pos
} //end meta album
break;
case 'search':
$pagetitle = "$lang_pagetitle_php[photogallery] $lang_pagetitle_php[divider] $lang_search_php[0]";
break;
case 'upload' :
$pagetitle = "$lang_pagetitle_php[photogallery] $lang_pagetitle_php[divider] $lang_main_menu[upload_pic_lnk]";
break;
case 'displayimagepopup' :
$pagetitle = "$lang_pagetitle_php[photogallery] $lang_pagetitle_php[divider] $lang_main_menu[upload_pic_lnk]";
break;
case 'ecard' :
$pagetitle = "$lang_pagetitle_php[photogallery] $lang_pagetitle_php[divider] $lang_ecard_php[title]";
break;
case 'editpics' :
$pagetitle = "$lang_editpics_php[edit_pics]";
break;
case 'groupmgr' :
$pagetitle = "$lang_groupmgr_php[title]";
break;
case 'reviewcom' :
$pagetitle = "$lang_reviewcom_php[title]";
break;
case 'searchnew' :
$pagetitle = "$lang_search_new_php[page_title]";
break;
case 'upload' :
$pagetitle = "$lang_upload_php[title]";
break;
default:
$pagetitle = "$lang_pagetitle_php[photogallery] ";
break;
} //end switch
switch ($cat) { // have category
case ($cat < 0):
$sql = "SELECT title FROM cpg_albums WHERE aid='" . (- $cat) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[title];
break;
case (($cat > 0)&&($cat < 10000)) :
$sql = "SELECT namee FROM cpg_categories WHERE cid='$cat'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row[namee];
break;
case ($cat > 10000) :// cat is between 1 and 9999 user gallery
$sql = "SELECT username FROM nuke_users WHERE user_id='" . ($cat-10000) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$albumname = $row['username'];
$albumname = "$albumname$lang_pagetitle_php[usr]";
break;
} //end category switch cases
if ($cat!=0)$pagetitle = "$lang_pagetitle_php[photogallery] $lang_pagetitle_php[divider] $albumname $ttrail";
?>
Save file as pagetitle.inc.php in modules/coppermine/include
I upload it to my coppermine folder and then global find and replace this line
$pagetitle = "- Coppermine";
with
// $pagetitle = "- Coppermine";
include("modules/coppermine/include/pagetitle.inc.php");
i
Way to go, gtroll!
Now it's language aware and we can even specify the divider.
What I did is only for the page that can be spidered. Now I think it covers all pages, right?
Great!