Oct 19

Hey! Why should Wordpress have all the cool features? I really like seeing the latest comments in a sidebar on blogs that I read and thought why shouldn’t this be something for Coppermine Photo Gallery. If you can leave comments on photos then you should be able to see the latest ones without having to view the “Last Comment” and wait for the images to load. So with that I give you the hack to display the latest comments on your gallery.

This hack is using the i3Theme Classic Center Edition from MangoOrgange that I’ve ported to Coppermine and changed the color scheme. It’s called MellowYellow and it’s really easy on the eyes. The code additions are easy to implement because in most cases all you have to do is copy and paste the below code into your theme.php file. I’ve outlined the specific instructions where this may not be the case.

Copy and paste the below code into your theme.php before the ending “?>” tag.

{code type=php}
// This function is for displaying latest comments in list form in a sidebar.
// Change the number of comments to display by editing “$comment_cnt”.
// Please acknowledge use of this code by including this header.
// Develeoped for Coppermine Photo Gallery by Billy Bullock – www.billygbullock.com
function lastcomments()
{
global $CONFIG;
$comment_cnt = 4; //change this number for comments to display
$select_columns = ‘p.aid, p.*, msg_body, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date’;

if (USER_ID) {
$query = “SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = ‘YES’ AND c.pid = p.pid ORDER by msg_id DESC LIMIT $comment_cnt”;
$result = cpg_db_query($query);
}else{
$query = “SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} AS c, {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_ALBUMS']} AS a WHERE c.pid = p.pid AND p.aid = a.aid AND approved = ‘YES’ AND visibility = 0 ORDER by msg_id DESC LIMIT $comment_cnt”;
$result = cpg_db_query($query);
}

while ($row = mysql_fetch_assoc($result)) {
if ($CONFIG['enable_smilies']) { //displays smilies if enabled in configuration. Also need “function process_smilies_custom” & “function get_smilies_table_custom()”.

written by Billy \\ tags: , , , , , , ,

Sep 23

There was a request over at the Coppermine Photo Gallery Forum for a port of the WordPress i3Theme. This is a great theme designed by N.Design Studio then customized by Mickey Cheong Kah Meng of MangoOrange

written by Billy \\ tags: , , , ,

Aug 29

After getting most of the WordPress theme ports updated it was time to start on another cool theme port. Well, lo and behold Fabri came along just in time to suggest such a theme. So i3theme 1.7 Classic (Center Edition) by N.Design Studio was tackled and if I say so myself, I believe it turned out quite nice (after a couple of hiccups of course).

There are a lot of changes and additions to the theme.php file so be sure to read the “readme.txt” that is in the directory. I know… who reads the readme.txt but don’t complain if you spend hours trying to figure something out and it’s been right in your face the whole time.

The Coppermine admin config has a couple of wide tables which can wreck havoc on a fixed width theme mainly the groups and users managers. There are times when using tables are necessary and this is one of them but still…. I HATE IE! I got tired of hacking css to deal with IE and scroll bars that I figured out a simple script to determine when to use a scroll bar when these pages are accessed. The below code will switch the css styling to use a scroll bar but only on these pages. Now IE won’t go off and show scroll bars because it’s cranky. The function looks like this:

function scrollbar()
{
	if ($_SERVER['PHP_SELF'] == 'usermgr.php' || $_SERVER['PHP_SELF'] == 'groupmgr.php') {
		$content = '<div id="content_scrollbar">';
	} else {
		$content = '<div id="content">';
	}
	return $content;
}

Assign this function to a {TOKEN} in the pageheader:

function pageheader($section, $meta = '')
{
...
    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $charset,
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
        '{SCROLLBAR}' => scrollbar(),
        );
...
}

then place this {SCROLLBAR} token in the template.html page where the content <div> is located.

...
<!-- custom token for setting conditional CSS style for scrollbar in content area.
This instead of <div id="content"> -->
{SCROLLBAR}
    {GALLERY}
    <div class="cpg_footer">
	{THEME_SELECT_LIST}{LANGUAGE_SELECT_LIST}
	{LANGUAGE_SELECT_FLAGS}
	{VANITY}
    </div>
<!-- End custom token for content -->
...

What’s nice about this is now I don’t have to deal with IE hacks and it’s sure to work with all browsers.

Other features that were added are:

i3theme-1-7-classic

*truncated album descriptions*
*truncated image captions*
*simple search bar*
*opacity driven image links*
*cool admin menu icons by Francois Keller*

Check it out on the Coppermine demo site.

Later!

written by Billy \\ tags: , , , ,