Page 1 of 1

$serendipity['view'] == 'plugin' - which plugin?

Posted: Mon Jan 14, 2008 1:20 am
by Alexander Heß
When trying to determine which kind of page we're on, the view index in the $serendipity array is quite helpful. But what if it's a page that's generated by a plugin like serendipity_event_staticpages, serendipity_event_contactform or serendipity_event_freetag?

$serendipity['view'] gives 'plugin' in this case. Is there an easy way to find out which plugin?

I'm currently using these, but they are more like quick and dirty:

serendipity_event_staticpage:

Code: Select all

if (array_key_exists('staticpage_plugin', $serendipity) && count($serendipity['staticpage_plugin']->staticpage) > 0)
serendipity_event_contactform:

Code: Select all

if (substr_count($_SERVER['REQUEST_URI'], $serendipity[preg_replace('/^.+?(serendipity_event_contactform:\S+?\/permalink).+?$/i', '$1', implode(' ', array_keys($serendipity)))]))
serendipity_event_freetag:

Code: Select all

$taglink = parse_url($serendipity[preg_replace('/^.+?(serendipity_event_freetag:\S+?\/taglink).+?$/i', '$1', implode(' ', array_keys($serendipity)))]);
if (substr_count($_SERVER['REQUEST_URI'], $taglink['path']))

Re: $serendipity['view'] == 'plugin' - which plugin?

Posted: Tue Jan 15, 2008 4:45 pm
by garvinhicking
Hi!

You can check the $staticpage_pagetitle smarty variable, this is set by plugins. There's no specific variable that a plugin sets which indicates, which plugin took hold of the page.

We would need to modify every event plugin that can take on a page to make that possible, so it's a lot of BC work.

HTH,
Garvin