Making currentpage available in staticpage-plugin

Creating and modifying plugins.
Post Reply
mad-manne
Regular
Posts: 42
Joined: Wed Jan 23, 2008 4:56 pm
Location: Marl, Germany
Contact:

Making currentpage available in staticpage-plugin

Post 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.
Try not. Do or do not. There is no try. (YODA)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Making currentpage available in staticpage-plugin

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
mad-manne
Regular
Posts: 42
Joined: Wed Jan 23, 2008 4:56 pm
Location: Marl, Germany
Contact:

Re: Making currentpage available in staticpage-plugin

Post 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.
Try not. Do or do not. There is no try. (YODA)
Post Reply