forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: Hellblazer on April 16, 2011, 11:02:02 pm

Title: replace category with user galleries on the root page.
Post by: Hellblazer on April 16, 2011, 11:02:02 pm
When you are in the root page this is what I would like to see

http://iluvatarsgrace.com/testforum2/Gallery/index.php?cat=1

instead of

http://iluvatarsgrace.com/testforum2/Gallery/index.php

Bassically, I'd like to have the user gallery already expanded with the user gallery humbnails. As it stands now, to see the user gallery you have to click on it in the catergory section, I don't like that.

Is there a way to change it so that on the root page, the category section doesn't show, but instead it is replaced right away with the user gallery section?
Title: Re: replace category with user galleries on the root page.
Post by: Αndré on April 18, 2011, 01:30:22 pm
Here's the solution of the same question asked in the German support board (http://forum.coppermine-gallery.net/index.php/topic,70371.msg344666.html#msg344666):
Open index.php, find
Code: [Select]
                    if ($breadcrumb != '' || count($cat_data) > 0) {
                        theme_display_cat_list($breadcrumb, $cat_data, $statistics);
                    }
and replace with
Code: [Select]
                    if ($breadcrumb != '' || count($cat_data) > 0) {
                        if (isset($cat) && $cat != USER_GAL_CAT) {
                            starttable(-1, 'Benutzeralben');
                            echo "<tr><td>";
                            list_users();
                            echo "</td></tr>";
                            endtable();
                        }
                        theme_display_cat_list($breadcrumb, $cat_data, $statistics);
                    }
Title: Re: replace category with user galleries on the root page.
Post by: Hellblazer on April 18, 2011, 10:43:36 pm
:) Thanks. I can't read german so I couldn't find it hehe, but thanks for helping out.
Title: Re: replace category with user galleries on the root page.
Post by: Hellblazer on April 18, 2011, 10:51:25 pm
Just tested it, It's almost that  :)

The category is still showing, where you have the line

Category:
Users Galleries                                                  1 album  4 pictures

I wand that to dissapear and only have the users galleries to show up. At the moment with the fix that you gave me the category is still showing, and when I click on one of the users albums that shows, it brings to an other page of Users Galleries that I have to press on the albums again to view their pictures.
Title: Re: replace category with user galleries on the root page.
Post by: Hellblazer on April 18, 2011, 10:58:42 pm
Sorry for the tripple consecutive post, there's no edit button so I can't add the info in the same post.

Here's what I'm talking about where you see the category section still.

http://iluvatarsgrace.com/testforum2/Gallery/index.php
Title: Re: replace category with user galleries on the root page.
Post by: Αndré on April 19, 2011, 09:29:22 am
Remove / comment out
Code: [Select]
theme_display_cat_list($breadcrumb, $cat_data, $statistics);to remove
Users Galleries                                                  1 album  4 pictures


when I click on one of the users albums that shows, it brings to an other page of Users Galleries that I have to press on the albums again to view their pictures.
That's intended as every user has its own category with personal albums. Do you want to display all user albums on the start page?
Title: Re: replace category with user galleries on the root page.
Post by: Hellblazer on April 19, 2011, 11:12:41 am
Hmm. That's a very good question, if it displays all the user albums it could get very messy. Would there be a way to randomize the user galleries that is displayed?
Title: Re: replace category with user galleries on the root page.
Post by: Αndré on April 19, 2011, 11:17:28 am
What exactly is a user gallery in your eyes? Do you mean the different user categories or the different albums that each user creates in his personal category?
Title: Re: replace category with user galleries on the root page.
Post by: Hellblazer on April 19, 2011, 12:25:05 pm
For me it's the albums. What I'm thinking is that on the root page of the gallery, where the user galeries are shown (since I've replaced the category section with your help) I would like to see a random 3 rows by 5 colums of random albums.

Also I was thinking that the title "Users galleries" which was previously named Benutzeralben in german, should be a link that would bring to the users gallery page where people see all the albums. Don't know if it's doable?
Title: Re: replace category with user galleries on the root page.
Post by: Αndré on May 05, 2011, 09:28:59 am
Also I was thinking that the title "Users galleries" which was previously named Benutzeralben in german, should be a link that would bring to the users gallery page where people see all the albums. Don't know if it's doable?
Just add the link to the title, e.g.
Quote
starttable(-1, '<a href="index.php?cat=1">User galleries</a>');


I would like to see a random 3 rows by 5 colums of random albums.
I'd create a new meta album in that case, which you can add in the Coppermine config. I'll create the code soon.
Title: Re: replace category with user galleries on the root page.
Post by: Αndré on May 05, 2011, 11:20:33 am
Here the instructions how you can display random user albums on your start page. I assume unmodified core files.

1. Open include/functions.inc.php, find
Code: [Select]
case 'random': // Random filesand above, add
Code: [Select]
    case 'randuseralb':

        $album_name = '<a href="index.php?cat=1">User galleries</a>';

        $query = "SELECT COUNT(*)
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND approved = 'YES'
                AND a.category > 10000
                GROUP BY r.aid
                HAVING COUNT(r.pid) > 0
                ORDER BY RAND()
                $limit";
        $result = cpg_db_query($query);
        $count = mysql_num_rows($result);
        mysql_free_result($result);

        $query = "SELECT *
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND approved = 'YES'
                AND a.category > 10000
                GROUP BY r.aid
                HAVING COUNT(r.pid) > 0
                ORDER BY RAND()
                $limit";
        $result = cpg_db_query($query);
        $rowset = cpg_db_fetch_rowset($result);
        mysql_free_result($result);

        build_caption($rowset);

        $rowset = CPGPluginAPI::filter('thumb_caption_randuseralb', $rowset);

        return $rowset;
        break;


2. Open your theme's theme.php file and search the function theme_display_thumbnails. If it doesn't exist, copy it from themes/sample/theme.php. Then, find
Code: [Select]
'albums' => array('lastalb')and replace with
Code: [Select]
'albums' => array('lastalb', 'randuseralb')

3. Add
Code: [Select]
randuseralb,3to The content of the main page (http://documentation.coppermine-gallery.net/en/configuration.htm#admin_album_list_content) in the Coppermine config.


Maybe I'll add that album to the more_meta_albums plugin if I have some more spare time.
Title: Re: replace category with user galleries on the root page.
Post by: Αndré on May 06, 2011, 05:04:04 pm
Maybe I'll add that album to the more_meta_albums plugin if I have some more spare time.
Done: http://forum.coppermine-gallery.net/index.php/topic,63706.msg349609.html#msg349609