Different layout for startpage

Skinning and designing Serendipity (CSS, HTML, Smarty)
User avatar
Hannes
Regular
Posts: 26
Joined: Fri Apr 22, 2005 12:46 pm
Location: Vienna
Contact:

Post by Hannes » Sun Sep 11, 2005 9:23 pm

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

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Mon Sep 12, 2005 4:55 pm

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
# 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/

User avatar
Hannes
Regular
Posts: 26
Joined: Fri Apr 22, 2005 12:46 pm
Location: Vienna
Contact:

Post by Hannes » Mon Sep 12, 2005 5:07 pm

:D HALLELUJA :D

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

Regards,

Hannes :P

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Mon Sep 12, 2005 5:24 pm

You're welcome. Great we now solved this together. Have fun with Serendipity and spread the word. :)

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/

User avatar
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Frontpage customization

Post by judebert » Wed Nov 16, 2005 4:14 am

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.

MySchizoBuddy
Regular
Posts: 340
Joined: Sun Jun 12, 2005 5:28 am

Post by MySchizoBuddy » Thu Nov 17, 2005 12:36 am

Hanees can i see ur site. I wanna know what ur talking about
:)
Image

Post Reply