[MOD] Displaying last additions for particular category [MOD] Displaying last additions for particular category
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

[MOD] Displaying last additions for particular category

Started by Makc666, June 07, 2007, 06:24:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Makc666

This one is for:
Modifications/Add-Ons/Hacks
Mods: Visuals
http://forum.coppermine-gallery.net/index.php?board=82.0
CPG 1.4.x
Tested with 1.4.10

Description:
If you want to display last additions for particular category this modification is for you.

1.
Open file:
index.php

2.
Find code:
                    case 'anycontent':
                        if ($cat == 0) {
                            ob_start();
                            /**
                             * Any php code or HTML can be put in this file and will be displayed
                             */
                            include('anycontent.php');
                            $anycontent = CPGPluginAPI::filter('anycontent',ob_get_contents());
                            ob_end_clean();
                            echo ($anycontent);
                        }
                        flush();
                        break;


3.
After add code:

                    case 'anycontent2':
                        if ($cat == 0) {
                            ob_start();
                            /**
                             * Any php code or HTML can be put in this file and will be displayed
                             */
                            include('anycontent2.php');
                            $anycontent2 = CPGPluginAPI::filter('anycontent2',ob_get_contents());
                            ob_end_clean();
                            echo ($anycontent2);
                        }
                        flush();
                        break;


4.
Go to:
"Config" -> "Album list view" -> "The content of the main page"

5.
Add in the beginnig of the line:
anycontent2,3/

So, for example, you will have line:
anycontent2,3/lastup,3/random,1/breadcrumb/catlist/alblist

6.
Download file:
anycontent2.zip

7.
Unpack from archive and open it in any text editor the file:
anycontent2.php

8.
Find block of code:
////////////////////////
//Category number
$cat2 = 2;
////////////////////////


9.
Set $cat2 (line 39) to the category number you need and save the file.

10.
Find block of code:
////////////////////////
//Case type (look below for avaliable types)
$case2 = 'lastup';
////////////////////////


11.
Set $case2 (line 42) to the case type you need and save the file.


  • 'lastup': last uploads
  • 'random': random files (setting this one to random files for huge categories with more than 10,000 pics might result in performance problems; change to something else in this case)
  • 'lastcom': last comments
  • 'topn': most viewed
  • 'toprated': top rated
  • 'lasthits': last viewed
  • 'lastalb': last albums to which uploads
  • 'favpics': particular user's favourite pictures sorted by last uploads

12.
Upload to the gallery root that file:
anycontent2.php

P.S. There is also a line in anycontent2.php:
starttable("100%", "Powered by Coppermine Photo Gallery Forum and Makc666");
You can comment it out (add double slashes // at the beginning of the line)
or
change to any text you like :P

Makc666

I fixed one thing, so you can reupload the archive or change manually
$cat to $cat2 in line:
display_thumbnails2('lastup', $cat2, 1, $CONFIG['thumbcols'], max(1, $matches[2]), true);

Also you have to know what true means in line:
display_thumbnails2('lastup', $cat2, 1, $CONFIG['thumbcols'], max(1, $matches[2]), true);

If you set it to true and you have more pictures in choosen category than you will have information bar at the bottom of that block.
Look at attached picture: anycontent2-true.png

If you set it to false than you will not have information bar at the bottom of that block.

miamimees

Was exactly, what I was looking for!
I wanted it so that lastup on the main page doesn't show anything from user albums.

Thanks a lot to the author!

Makc666

I updated the mod. You can redownload the file from the first post if you want.

Now you can select which case type you want to see in that block (chrisjd asked me for this one).

  • 'lastup': last uploads
  • 'random': random files (setting this one to random files for huge categories with more than 10,000 pics might result in performance problems; change to something else in this case)
  • 'lastcom': last comments
  • 'topn': most viewed
  • 'toprated': top rated
  • 'lasthits': last viewed
  • 'lastalb': last albums to which uploads
  • 'favpics': particular user's favourite pictures sorted by last uploads

chrisjd

It works great and makes CPG more and more worthy to me! Many thanks from Germany to Moscow!


elphie


Joachim Müller

It is attached to the very first posting in this thread. Please read the thread before replying.

elphie

Quote from: Joachim Müller on April 11, 2008, 09:01:19 AM
It is attached to the very first posting in this thread. Please read the thread before replying.

I did read the thread. I read the whole thread actually, and I haven't found a download link for the zip file.

elphie

OK, nevermind, I just found it. My eyes have been deceiving me lately. Sorry.

pixelroom

Sorry to dig up an old thread, but i was just wondering how to: instead of linking directly to the image I wanna link to the album view, because Im using this one a couple of times on the frontpage!

Joachim Müller

Your question is not related at all to the thread you're on. Start your own thread and respect board rules in the future.