Hey André
I'll try ... though I'll probably mess it up. I didn't write the code myself .. someone else did, and I just tried to hack it from the old files they modified, and integrate it into the new ones. So, OK .. here goes nothing;
index.php:
lines 1127 -> 1140
get_cat_list($breadcrumb, $cat_data, $statistics);
if ($cat > 0)
{
$result = cpg_db_query("SELECT page_title, meta_description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '{$cat}'");
if (mysql_num_rows($result) > 0)
{
$rowX = cpg_db_fetch_row($result);
$page_title = $rowX['page_title'];
$meta_description = $rowX['meta_description'];
$BREADCRUMB_TEXT = $page_title ? $page_title : $BREADCRUMB_TEXT;
$addition_meta = "<meta name=\"description\" content=\"".addslashes($meta_description)."\" />"."\n";
}
}
thumbnails.php
lines 104
$result = cpg_db_query("SELECT category, title, aid, keyword, description, alb_password_hint, page_title, meta_description FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = $album");
line 141 - 142
if ($cat < 0) {
$result = cpg_db_query("SELECT category, title, aid, keyword, description, alb_password_hint, page_title, meta_description FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = " . (- $cat));
line 209 - 219
// after that add
$meta_description = $CURRENT_ALBUM_DATA['meta_description'] ? $CURRENT_ALBUM_DATA['meta_description'] : $CURRENT_ALBUM_DATA['description'];
if ($meta_description)
{
$meta_keywords .= '<meta name="description" content="' . htmlspecialchars($meta_description) . '" />' . $LINEBREAK;
}
$section = $CURRENT_ALBUM_DATA['page_title'] ? $CURRENT_ALBUM_DATA['page_title'] : $section;
fix.php
<?php
define('IN_COPPERMINE', TRUE);
include 'include/init.inc.php';
cpg_db_query("
ALTER TABLE `{$CONFIG['TABLE_CATEGORIES']}`
ADD `page_title` TEXT NOT NULL ,
ADD `meta_description` TEXT NOT NULL
");
?>
editpics.php
line 151 - 152
array($icon_array['title'] . 'Page Title', 'page_title', 0, 255),
array($icon_array['description'] . $captionLabel, 'caption', 2, $CONFIG['max_img_desc_length']),
line 224
$page_title = get_post_var('page_title', $pid);
line 27
$update .= ", page_title = '$page_title'";
edit_one_pic.php
line 78
$page_title = cpgSanitizeUserTextInput($superCage->post->getEscaped('page_title'));
line 119
$update .= ", page_title = '{$page_title}'";
line 369
$result = cpg_db_query("SELECT *, p.title AS title, p.page_title as page_title, p.votes AS votes FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE pid = '$pid'");
lines 510 - 517
<tr>
<td class="tableb" style="white-space: nowrap;">
{$icon_array['title']}Page Title
</td>
<td width="100%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="page_title" maxlength="255" value="{$CURRENT_PIC['page_title']}" class="textinput" />
</td>
</tr>
displayimage.php
lines 500 - 503
$rowX = cpg_db_fetch_row(cpg_db_query("SELECT page_title FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = '{$CURRENT_PIC_DATA['pid']}'"));
$page_title = $rowX['page_title'] ? $rowX['page_title'] : $picture_title;
pageheader($page_title . ' | ' . $album_name, $meta_keywords, false);
db_input.php
lines 377 - 378
$page_title = $superCage->post->getEscaped('page_title');
$meta_description = $superCage->post->getEscaped('meta_description');
line 423
$query = "UPDATE {$CONFIG['TABLE_ALBUMS']} SET title = '$title', description = '$description', category = $category, thumb = $thumb, comments = '$comments', votes = '$votes', visibility = $visibility, alb_password = '$password', alb_password_hint = '$password_hint', keyword = '$keyword', page_title = '{$page_title}', meta_description = '{$meta_description}'";
catmgr.php
lines 67
$sql = "SELECT rgt, cid, parent, name, pos, page_title, meta_description FROM {$CONFIG['TABLE_CATEGORIES']} ORDER BY lft ASC";
lines 515
$result = cpg_db_query("SELECT cid, name, parent, description, thumb, page_title, meta_description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = $cid");
lines 544-545
$page_title = $superCage->post->getEscaped('page_title');
$meta_description = $superCage->post->getEscaped('meta_description');
lines 553 - 557
if (!in_array($parent, $children)) {
cpg_db_query("UPDATE {$CONFIG['TABLE_CATEGORIES']} SET parent = $parent, name = '$name', description = '$description', page_title = '{$page_title}', meta_description = '{$meta_description}', thumb = $thumb, lft = 0 WHERE cid = $cid");
} else {
cpg_db_query("UPDATE {$CONFIG['TABLE_CATEGORIES']} SET name = '$name', description = '$description', page_title = '{$page_title}', meta_description = '{$meta_description}', thumb = $thumb, lft = 0 WHERE cid = $cid");
}
lines 762 - 777
<tr>
<td width="40%" class="tableb">
Page Title
</td>
<td width="60%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="page_title" value="{$current_category['page_title']}" class="textinput" />
</td>
</tr>
<tr>
<td class="tableb" valign="top">
Meta Description
</td>
<td class="tableb" valign="top">
<textarea name="meta_description" rows="5" cols="40" style="width: 100%;" class="textinput">{$current_category['meta_description']}</textarea>
</td>
</tr>
modifyalb.php
lines 94 - 95
array('Album - Page Title', 'page_title', 0),
array('Album - Meta Description', 'meta_description', 3),
There's probably much easier, cleaner and more efficient ways to do it .. it would seem to me it should be a pretty simple mod .. but that's what I have in my cpg gallery. It's not perfect .. I seem to get 2 meta description tags, which I don't know how to resolve. I also end up with "| Stock photos" as the end part of every title tag, which I don't know how to remove.
But this code gives me the option to write a custom Title Tag for each album and category. A custom field opens up when I edit or create a new album/category.
I hope this is of some help to anyone else. If it's apparent I've overlooked part of the code in copying it here, let me know and I'll see if I can find anything else that has been edited.
Cheers
Carl