Page 1 of 1

Plugin detection for "Is shown on startpage?" now

Posted: Sun Nov 27, 2005 8:13 pm
by garvinhicking
Hi all!

Currently some plugins try to autodetect if the plugin's "genpage" hook is called on the frontpage of the blog.

I now added this code-snippet to the default genpage.inc.php file of Serendipity 1.0 (nightlies) so that you can use $addData['startpage'] to see whether your plugin is called on the startpage, or not.

HTH,
Garvin

Posted: Tue Nov 29, 2005 7:42 pm
by garvinhicking
I think a sidebar plugin should be able to access $GLOBALS['uri_addData']['startpage'], yes.

Regards,
Garvin

Posted: Sat Dec 03, 2005 4:36 pm
by judebert
Hey, Garvin.

The frontpage detection isn't working for me. I just downloaded yesterday's nightly; when my plugin tries to detect the frontpage, it fails.

I'm accessing the page directly via the complete pretty URL. Apache redirect is on. The URL is http://judebert.com/wasted_youth/index.php -- I'm running s9y side-by-side with my existing static pages, so if I use index.html it'll load the old static page. I added debugging to print 'Front Page detected.' or 'Not Front Page!' at the bottom of the page; as you can see, genpage is being hooked twice, and it always thinks there's no front page.

Before switching, I was detecting frontpage with:

Code: Select all

            if ((!empty($args) && trim($args) == $serendipity['indexFile'])
                || isset($serendipity['GET']['adminModule'])
                || isset($serendipity['GET']['category'])
               )
...which seemed to work from every hook, but didn't detect archive or single entries. I can correct those after a bit of research, but I'd rather use the provided hook, since I don't know what else my frontpage detection might be missing.

Posted: Sun Dec 04, 2005 12:39 pm
by garvinhicking
How does your plugin try to do the frontpage detection exactly?

Ah, nah. Forget it. There was a typo in genpage.inc.php (uriaddData instead of uri_addData). Just fixed, thank you!

Regards,
Garvin