[cpg1.5.x]: Show anycontent on Home Page only v1.0 [cpg1.5.x]: Show anycontent on Home Page only v1.0
 

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

[cpg1.5.x]: Show anycontent on Home Page only v1.0

Started by Joe Carver, March 11, 2010, 03:04:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joe Carver

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

Joachim Müller

Why not just put this into anycontent?
<?php
if ($cat == '') {
    echo 
'Hello world';
} else {
    
// do nothing
}
?>

Joe Carver

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.

Joachim Müller

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.

Joe Carver

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.
<?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:
Quote from: Joachim Müller on March 11, 2010, 01:31:37 PM
I would have expected a more sophisticated plugin,
What did you have in mind?  :)  Thanks again