Page 2 of 2

Posted: Sun Sep 11, 2005 9:23 pm
by Hannes
The plugin-unsetting is only available in serendipity 0.9, I forgot to mention. You are using that, right?
Yes, now. Startpage has a unique template and displays only a special sidebar plugin. :D The links to the other subpages and the link to display an blog-entry are not working properly.

Here is my code. Beginning with the event_hook function:

Code: Select all

function event_hook($event, &$bag, &$eventData, $addData = null) {
        global $serendipity;

        $hooks = &$bag->get('event_hooks');

        if (isset($hooks[$event])) {
            switch ($event) {
                case 'genpage':
                    $args = implode('/', serendipity_getUriArguments($eventData, true));
                   
                    if ($serendipity['rewrite'] != 'none') {
                        $nice_url = $serendipity['serendipityHTTPPath'] . $args;
                    } else {
                        $nice_url = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?/' . $args;
                    }

                  if ((empty($args) || trim($args) == $serendipity['indexFile']) && (empty($serendipity['GET']['subpage']) || $serendipity['GET']['subpage'] == $nice_url)) {
                        $serendipity['GET']['custompage'] = 'customstart';
                        $serendipity['template']       = 'royal'; // HANNO: Insert your template name for the startpage here.
                    }  else {
                       	print_r($nice_url);
                        print_r($args);
                        print_r($serendipity['indexFile']);
                        print_r($serendipity['GET']);
                        die('You did not simply call the startpage, but supplied GET parameters to the page. Serendipity does not recognize this as your startpage.');
                    } 
                    break;

                case 'frontend_generate_plugins':
                    $plugins =& $eventData;
                    if ($serendipity['GET']['custompage'] != 'customstart') {
                        return false;
                    }

                    foreach ($plugins as $idx => $plugin_data) { 
                      // HANNO: Insert the name of the single plugin you want to keep here.
                      if ($plugin_data['name'] != '@serendipity_archives_plugin:13c33ce69xxxxxx') {
                            unset($plugins[$idx]);                            
                        }
                    }
                   
                    break;

                default:
                    return false;
                    break;
            }
        } else {
            return false;
        }
    }
Regards,

Hannes

Posted: Mon Sep 12, 2005 4:55 pm
by garvinhicking
That sounds great :)

Just remove all print_r() and die() calls (or prefix them with a "#" to uncomment) and then all should be well! :)

Best regards,
Garvin

Posted: Mon Sep 12, 2005 5:07 pm
by Hannes
:D HALLELUJA :D

Thank you once again for your GREAT and quick support!!!

Regards,

Hannes :P

Posted: Mon Sep 12, 2005 5:24 pm
by garvinhicking
You're welcome. Great we now solved this together. Have fun with Serendipity and spread the word. :)

Regards,
Garvin

Frontpage customization

Posted: Wed Nov 16, 2005 4:14 am
by judebert
Well, I'm busy working on something like this. Glad I stumbled across this topic.

Garvin, perhaps Serendipity core should call a different template file for the frontpage? Instead of entries.tpl, could frontpage.tpl be called if it's available? That would simplify a lot of the customization trouble.

Posted: Thu Nov 17, 2005 12:36 am
by MySchizoBuddy
Hanees can i see ur site. I wanna know what ur talking about
:)