This mod allows you to set different themes for different categories. Any albums or pics viewed inside that category will be displayed in the specified theme.
There are 3 parts to this mod.
1) You need to add a new field into your database:
ALTER TABLE `cpg_categories` ADD `cat_theme` VARCHAR( 32 ) NOT NULL ;
Run that query in phpmyadmin or whatever you like to use. Change cpg_ to the actual prefix you chose during installation.
2) Edit include/init.inc.php
find:
// Process theme selection if present in URI or in user profile
if (!empty($_GET['theme'])) {
$USER['theme'] = $_GET['theme'];
}
Before that, add this code:
// Process category specific themes
$cid = 0;
if (isset($_GET['cat'])){
$cid = (int) $_GET['cat'];
} elseif (isset($_GET['album'])){
$aid = (int) $_GET['album'];
$result = cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '$aid' LIMIT 1");
if (mysql_num_rows($result)) list($cid) = mysql_fetch_row($result);
} elseif (isset($_GET['pos'])){
$pid = (int) -$_GET['pos'];
$result = cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} AS a INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = a.aid WHERE pid = '$pid' LIMIT 1");
if (mysql_num_rows($result)) list($cid) = mysql_fetch_row($result);
} elseif (isset($_GET['id'])){
$pid = (int) $_GET['id'];
$result = cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} AS a INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = a.aid WHERE pid = '$pid' LIMIT 1");
if (mysql_num_rows($result)) list($cid) = mysql_fetch_row($result);
}
if ($cid){
$result = cpg_db_query("SELECT cat_theme FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '$cid' LIMIT 1");
if (mysql_num_rows($result)) list($CONFIG['theme']) = mysql_fetch_row($result);
}
3) Update the category manager to provide the new option.
Since the changes here are numerous, I have attached a pre-modded catmgr.php. Download it from this post, extract it, and overwrite your existing catmgr.php.
This mod kindly sponsored by
julala.