forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: Joe Carver on March 11, 2010, 03:04:04 am

Title: [cpg1.5.x]: Show anycontent on Home Page only v1.0
Post by: Joe Carver on March 11, 2010, 03:04:04 am
The plugin will remove the display of anycontent.php from the main Album list page (index.php?cat=0).

This can help to avoid showing duplicate content equal to the main Home page.

There is no configuration available - just install and go. Advanced users could edit the file codebase.php to add a different anycontent to Album list page (index.php?cat=0). There are comment lines clearly marking where edits could be added.

Demo Here (http://photos-by.joe-carver.com/index.php)
Title: Re: [cpg1.5.x]: Show anycontent on Home Page only v1.0
Post by: Joachim Müller on March 11, 2010, 07:45:06 am
Why not just put this into anycontent?
Code: [Select]
<?php
if ($cat == '') {
    echo 
'Hello world';
} else {
    
// do nothing
}
?>
Title: Re: [cpg1.5.x]: Show anycontent on Home Page only v1.0
Post by: Joe Carver on March 11, 2010, 12:41:17 pm
No reason at all - that seems to work just fine.

But since I had wrote the plugin package for the newbie/novice users who would not be aware of cpg's variables maybe I will redo it with your if/else and rename it as "Alternate or No anycontent for the main album list".

Unless, of course, it is indicated that I would be wasting my time.
Title: Re: [cpg1.5.x]: Show anycontent on Home Page only v1.0
Post by: Joachim Müller on March 11, 2010, 01:31:37 pm
Hehe, no: your contribution is of course fine and welcome ;D. But this plugins looks sort-of redundant to me: anycontent only makes sense for those who know their way around in PHP a bit. Given your skills I would have expected a more sophisticated plugin, but that's fine as well: everybody likes easy.
Title: Re: [cpg1.5.x]: Show anycontent on Home Page only v1.0
Post by: Joe Carver on March 11, 2010, 05:55:11 pm
Thanks - although I think I could make a good argument against my skillset...

At the moment I am going to make only a couple of small changes. Adding tables and changing the expression for matching to the newer output of SEF url's.

Unfortunately using $cat as for the if/else does not appear to work - I should have remembered this when replying earlier having learned through using a similar routine for the iScroll plugin.

Somehow Coppermine treats/reads the value $cat different when in index.php  vs. when it reads it from the plugin and perhaps elsewhere. It returns $cat=0 when on the home page when in my plugins.

This can be seen/proven by making a simple "custom footer" with this code.
Code: [Select]
<?php
global 
$cat;
echo $cat;
?>
It will always echo 0 for $cat on the home page.

I respectfully await any suggestions - but for something so simple, please don't use any time that you might not have. However I am curious when you wrote:
I would have expected a more sophisticated plugin,
What did you have in mind?  :)  Thanks again