Page 1 of 1

Making currentpage available in staticpage-plugin

Posted: Wed Jan 23, 2008 6:04 pm
by mad-manne
Hi there s9y-community ...
I am using the static-page plugin, and don't want to use the available navigation-feature. I was only looking for template-variables that contain the headline and permalink for the current page I am on, and either I failed to find them or they just aren't there :roll: ...
So I added the following little hack to /plugins/serendipity_event_staticpage/serendipity_event_staticpage.php
FIND

Code: Select all

                    'prev' => array(
                        'name' => $this->get_config('showtextorheadline') ? STATICPAGE_PREV : $pages[$i-1]['pagetitle'],
                        'link' => $pages[$i-1]['permalink']
                    ),
BEFORE, ADD

Code: Select all

                    'current' => array(
                        'headline' => $pages[$i]['headline'],
                        'link' => $pages[$i]['permalink']
                    ),
Given that I haven't done any mistake(atleast it works on my site), this modification should add the following two variables that can be used within the template:
  • $staticpage_navigation.current.link = the link to the current static page
  • $staticpage_navigation.current.headline = the headline of the current static page
I have just started with s9y, and am far away from having a good insight into the code-structure or who to contact for feature-requests of plugins, etc.
If anyone finds this code-snippet useful, let me know 8)

Cheers,
Manfred.

Re: Making currentpage available in staticpage-plugin

Posted: Wed Jan 23, 2008 8:11 pm
by garvinhicking
Hi!

Thanks a lot for sharing your code! Actually, the "current" page should be in its own variable scope, have you tried to use {$staticpage_headline} and {$staticpage_permalink} instead?


Your code should work fine as well, but I believe it should not be necessary. Sadly at the moment, I don't have a test installation to test it out, but {$staticpage_*} should map all database columns of the current page...

Best regards,
Garvin

Re: Making currentpage available in staticpage-plugin

Posted: Wed Jan 23, 2008 8:22 pm
by mad-manne
garvinhicking wrote:Thanks a lot for sharing your code!
It's me who says thankyou for sharing *your* code with the world :wink:
Actually, the "current" page should be in its own variable scope, have you tried to use {$staticpage_headline} and {$staticpage_permalink} instead?
In fact, these 2 work like a charm. So I can revert my serendipity_event_staticpage.php back to the original state :P

Cheers,
Manfred.