Possible to detect if the current page is the home page, cat=0 within theme.php? Possible to detect if the current page is the home page, cat=0 within theme.php?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Possible to detect if the current page is the home page, cat=0 within theme.php?

Started by tenacjed, January 13, 2014, 09:37:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tenacjed

My site: http://www.waggonerphotography.com/gallery2/index.php?cat=0
running latest 1.5.26

Hopefully this will be my last question for a while!

I tried to implement this update from another post:  http://forum.coppermine-gallery.net/index.php/topic,73525.msg354381.html#msg354381 (reply 7 if it does not go right to it).  My main page has a lot of categories, with sub categories then albums.  I like the multi column look for categories that I found in a different post, but when the categories are nested multiple times, it looks confusing.  The above post works by setting the top category by itself in a row, then sub categories in a table of 3.  My site is currently running a table of 2, which is what I prefer and had set.  The above link works perfectly on the main page, however things break when you go to a category that only has categories with no sub categories, or just albums, which the original poster in the above thread found as well.

I was thinking that a good resolution would be a if else statement.  If statement would look for theme.php?cat=0, then run the code in the above link.  The else would have the current code that I already have running.  This would give the home page the look that I am looking for, and then when going into category pages they would not be broke and would still look proper as well.

I really hope this makes sense.  I currently do not have the code above running to show examples, but I can go through and enable it again if needed.   If it is possible, I just need to know what the initial If statement should be, I can hack my way through the rest of it  :).  I can post the final code for others once it is all worked out.

Thank You,

John W

What a long... strange trip it's been!!!

tenacjed

What a long... strange trip it's been!!!

tenacjed

Gallery: www.waggonerphotography.com/gallery2
So I implemented the code again from the first post to set top level category on its own row, but it is no working like I thought.  On most categories it does work, but there are some like Insects on the main page that does not sit in its own row.


Thinking about this some more and I realized that every category that has no albums I would like to be a single row starting on the left,  in the 2 column category listing.  Is it possible to check to see if the category is empty of albums, ignoring sub categories?  This would be ideal, then the category would start a new row in the column and have nothing else listed in the 2 column listing.


So if we look here http://www.waggonerphotography.com/gallery2/index.php?cat=61
2013, 2012, and 2010 categories look good, but 2011, 2009, 2008, and 2007 are not in their own row like I would like.

Looking at the main gallery listing, Trips would be a single row on the left, but so would 2013, 2012, 2011, 2010, 2009, 2008, and 2007.  Then the sub categories to all of those would be listed as 2 columns nested under it's parent category.

And this is where the current code breaks: http://www.waggonerphotography.com/gallery2/index.php?cat=21
There are only 3 categories with no sub categories, and the view is no longer correct, should still be 2 columns.
What a long... strange trip it's been!!!

tenacjed

I am sorry if I am not being clear, my head is starting to spin from staring at code!  I am very good with vbscript, and a little of powershell, vb6, and vb.net.  Then things go downhill with web coding, and I know nothing about PHP!
What a long... strange trip it's been!!!

tenacjed

I reverted back to the original 2 column category layout I was running previously since it does not have an issue listing single nested categories.   Let me know if I should close this thread and start a new one, I may have caused some confusion!

So my question is... is it possible to have any category that does not contain an album be in its own row within the 2 column category listing.  Looking at my main gallery listing, I am looking for this:

Trips
2013
Pantanal, Brazil                    Michigan
2012
Utah                                    East Coast
Arizona                                Michigan
Puerto Rico
2011
Florida                                 Europe
2010
Alaska
2009
Yellowstone National Park      Arizona
Michigan
2008
Michigan                               Grand Teton National Park
Yellowstone National Park   
2007
Kenya, Africa
What a long... strange trip it's been!!!

tenacjed

Marking as resolved due to having a new and different question as the original post.
What a long... strange trip it's been!!!

ΑndrĂ©

Without reading all posts or testing, the solution should be something like
$superCage = Inspekt::makeSuperCage();
if ($superCage->get->keyExists('cat') && $superCage->get->getInt('cat') > 0)) {
    // do something
} else {
    // do something else
}

tenacjed

What a long... strange trip it's been!!!