serendipity_event_staticpage (prev/next links)

Creating and modifying plugins.
Post Reply
JWalker
Regular
Posts: 177
Joined: Mon Sep 12, 2005 4:14 pm
Location: Botevgrad, Bulgaria
Contact:

serendipity_event_staticpage (prev/next links)

Post by JWalker »

Hi,
I wished to make Prev/Next links in the staticpage navigation to not show when no previous or Next page is available. (till now links to the current page are shown as previous or next links). The modification is in serendipity_event_staticpage.php, function getNavigationData(), just after assigning the $nav array and before return $nav:

Code: Select all

               $nav = array(
                    'prev' => array(
                        'name' => $this->get_config('showtextorheadline') ? STATICPAGE_PREV : $pages[$i-1]['pagetitle'],
                        'link' => $pages[$i-1]['permalink']
                    ),
                    'next' => array(
                        'name' => $this->get_config('showtextorheadline') ? STATICPAGE_NEXT : $pages[$i+1]['pagetitle'],
                        'link' => $pages[$i+1]['permalink']
                    ),
                    'top' => array(
                        'name' => (($top['id'] == $pages[$i-1]['id']) || ($this->get_config('showtextorheadline'))) ? STATICPAGE_TOP : $top['name'],
                        'link' => ($top['id'] == $page[$i-1]['id'] ? $serendipity['serendipityHTTPPath'] : $top['permalink'])
                    )
                );
                /*
                   remove link names when links are empty => as a result 'Prev' and/or 'Next'
                   do not show when no previous and/or next static pages are present
                */
                if ($this->get_config('showtextorheadline')) {
                    if ($nav['prev']['link'] == '') {
                        $nav['prev']['name'] = '';
                    }
                    if ($nav['next']['link'] == '') {
                        $nav['next']['name'] = '';
                    }
                    if ($nav['top']['link'] == '') {
                        $nav['top']['name'] = '';
                    }
                }
                return $nav;
Ivan Cenov
OKTO-7 Co., Botevgrad
Bulgaria
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: serendipity_event_staticpage (prev/next links)

Post by garvinhicking »

Thanks a lot! Committed to CVS!

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/
Post Reply