forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Visuals => Topic started by: PerlAddict on August 15, 2006, 04:54:37 pm
-
Well, I got my CPG up and running how I want it for the most part, with only a few major cosmetic changes left (like listing the users in the "Users Gallery" in the same layout as the main category page instead of like thumbnails). But one of the things I searched for and kept seeing people say wasn't available was a way to add an icon to the "Users Gallery" category on the main index page.
Of course, there's always a way to do something. Maybe not dynamically or as gracefully as we would like, but it can be done. So here's what I did to add an icon to my users gallery:
Find the following three lines in index.php:
$cat_data[] = array($link, $ident . $subcat['description'], $album_count, $pic_count);
$cat_data[] = array($link, $subcat['description'], 'cat_thumb' => $user_thumb);
$cat_data[] = array($link, $subcat['description'], $album_count, $pic_count, 'cat_albums' => $cat_albums, 'cat_thumb' => $user_thumb);
Now, after the last value in each array, between the word and the closing parenthesis, add this:
, "cat_id" => $subcat['cid']
So your lines should now look like this (using the first line of code as an example):
$cat_data[] = array($link, $subcat['description'], 'cat_thumb' => $user_thumb, "cat_id" => $subcat['cid']);
Now, I'm assuming that the special "Users Galleries" category always has a category ID of "1" ... if by chance it doesn't, just replace the number "1" in the following bit of code with the correct category number. For the image, naturally replace it with a link to the thumbnail you want to be shown and with the appropriate width and height dimensions. Like I said, it's not pretty or elegant, but it gets the job done as far as having a thumbnail there.
In your "themes/THEMENAME/themes.php" file (and/or your "includes/themes.inc.php" file, depending on how you set up and manage themes), find this line. It will be within the "function theme_display_cat_list" function:
if (!isset($category['cat_thumb'])) { $category['cat_thumb'] = ''; }
Change that code to this, remembering to update the image source, width, and height in the <img src> tag to point to the picture you want as your thumbnail for the Users Galleries category (in the example below, I'm just using a thumb for a picture I'd already uploaded into one of my galleries):
if (!isset($category['cat_thumb'])) {
if ($category['cat_id'] == USER_GAL_CAT) {
$category['cat_thumb'] = '<a href="index.php?cat=' . USER_GAL_CAT . '"><img src="albums/userpics/10002/thumb_members_icon.jpg" class="image" width="50" height="50" border="0" alt="" /></a>';
} else {
$category['cat_thumb'] = '';
}
}
There you go. You now have a thumbnail for your Users Galleries section.
[Added code tags and corrected some minor issues - Nibbler]
-
If you don't have theme_display_cat_list() in your theme.php you should copy the version from the sample theme into your theme.php and then modify your copy as suggested above. include/themes.inc.php should not be modified.
Thanks for your contribution.
-
Very much appreciated, Nibbler! Thanks for making those tidbits a bit more user friendly. :)
-
PerlAddict, do you have an example on a website ?
I would like to see the add-on on the CPG
Thanks
-
http://www.pcsar.net/gallery/ is where I currently have mine up. There's really not much to see, though ... it's just a thumbnail next to the user's gallery like what you would have on any of the other non-user galleries.
-
Looks like a great solution, but I'm having trouble getting it to work on my system.
I have adjusted the 3 lines in index.php adding as the last element of the array: , "cat_id" => $subcat['cid']
I have copied the theme_display_cat_list() function from /themes/samples/theme.php into /themes/mytheme/theme.php
Then I added the 7 lines of code to /themes/themename/theme.php as suggested. I adjusted the <img src> to point to the appropriate thumbnail picture.
It doesn't have any effect. Is there a step that I'm missing?
Thanks for your help, Joe
-
Not working here, either....think I'm a bit confused on editing the theme.php in my Kubrick theme, which does not contain the theme_display_cat_list() function anywhere. If I attempt to add it, I get a "cannot re-declare" error.
I made the first three changes as suggested but I'm lost. Has anyone else got this to work?
-
Post the actual error message.
-
I still have not been able to get it to work. There are no error messages, but also no picture.
I've checked over the code 10 times, but can't find anything I've missed. What's the best way to track the problem down?
You can see the gallery at: http://www.realadventures.com/gallery/
-
Okay, I got this to work but not by adding function theme_display_cat_list to my theme.php (Kubrick theme, heavily modified). I had to edit the function in themes.inc.php itself to get it to work but...for some reason the thumbnail isn't displaying, just the old red "X". The dimensions and path to the image are correct so what did I miss?
Nibbler: I realize you suggest not editing the themes.inc.php file but for me this isn't working any other way...is it possible to pull this function out of themes.inc.php and move it to my theme.php?
-
Everything that can be done by editing include/themes.inc.php can be accomplished by editing themes/yourtheme/theme.php as well. If you insist on editing themes.inc.php although we told you not to do so, you're on your own with this.
-
Nevermind...the path was incorrect. Well, not really; the image I uploaded had an extra "_" in the file name.
Thank you, PerlAddict, for a very nice mod. And thanks for your valuable input, Nibbler. It's working now. :D
-
Installed and working fine - but when I look at my Debug Info I see the following:
/index.php
* Notice line 770: Undefined index: system_icon
and
/themes/(my theme)/theme.php
* Notice line 1616: Undefined offset: 2
* Notice line 1617: Undefined offset: 3
points to this code:
$params = array('{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
'{CAT_DESC}' => $category[1],
'{CAT_ALBUMS}' => $category['cat_albums'],
'{ALB_COUNT}' => $category[2],
'{PIC_COUNT}' => $category[3],
);
echo template_eval($template, $params);
} else {
$params = array('{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
[line 1616] '{CAT_DESC}' => $category[1],
[line 1617] '{CAT_ALBUMS}' => '',
'{ALB_COUNT}' => $category[2],
'{PIC_COUNT}' => $category[3],
);
echo template_eval($template, $params);
can you suggest how to fix this?
thanks!
-
Turn notices off if they don't mean anything to you.
-
Hi,
I'm trying to use this mod on my CPG 1.4.10 gallery, and can't get it to work. Basically, nothing happens at all. Strangely enough, I was able to successfully install it in my other gallery which is still running .09... Has anyone been able to use this mod with the new version of coppermine? If so, did you have to change anything to get it to work?
thanks!
roland
-
Hi,
Please, correct this code for last version Coppermine!!!
-
I need to make thumbnail for personal galleries on the main page. Enough the simple picture which have been not connected with concrete galleries. Otherwise the input in personal galleries is imperceptible for users.
-
@ardeo & Ahtub:
Mod should works with 1.4.x , both of you probably didn't add it properly
-
Thanks, all really works.
-
works great it whould be very nice if you can show all users galeri thumbnails :)
-
Worked first time, thanks :-)
Would it be possible to automatically randomise the image from the user galleries?
-
Great Mod, is there a reason why the user gallery doesn't behave like the other categories? just curious
-
Because Coppermine was coded that way.
-
It looks like the code structure had changed quite a bit since this mod was written, the function theme_display_cat_list bares no resemblence to the one in the first post.
Can anyone help me out on a working version of this for 1.4.19?
Thanks
-
nvm i got it sorted ;)
-
Well, if you've got it sorted out, how about sharing. I am another who cannot find the search strings anywhere. It appears 1.4 is a new animal. Updated hacks would be appreciated.
-
It appears 1.4 is a new animal
Not really. The version cpg1.4.x has been around since 2005-07-02. I don't think you could call that "new", but rather old. I just went through the files that need editing when applying this mod: the lines that need editing haven't changed since the very first release of cpg1.4.x (most recent stable release currently is cpg1.4.24), so your comment doesn't apply. If you have issues when tyring to apply this mod, don't blame it on the release cycles, but post the details needed to make your posting an actual support request.