static page plugin

Creating and modifying plugins.
Post Reply
romulus
Regular
Posts: 49
Joined: Fri Sep 24, 2004 4:31 pm
Contact:

static page plugin

Post by romulus »

I have written a static page plugin which you can download from my site:

http://www.romulus23.de/uploads/romulus ... ge-0.3.zip

What does it do?

I'm still wondering why so many blogs only know "articles" with a fixed date which can be posted. This article gets older and older, maybe isn't displayed on the front page anymore, gets spammed and finally forgotten. But I always wanted to have some part of my blog/site that is static, most often used for a "about me" page, but not limited to that. And this page should be displayed in my blog design with normal formatting I have in all my other articles.

And basically, this is what this plugin does. I'm already using this plugin on my site (look into link "über mich" in upper right corner). You can add as many static pages as you want if you add this plugin in the desired number.

Who to thank?

Garvin. He has written almost all of this plugin in this post, though unkowingly ;)
Last edited by romulus on Sat Oct 16, 2004 6:24 pm, edited 3 times in total.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: static page plugin

Post by garvinhicking »

Hi romulus!

It's fairly easy to apply formatting. You just need to rename

Code: Select all

            $entry = array('staticpage' => $this->get_config('content'));
            serendipity_plugin_api::hook_event('frontend_display', $entry);
            echo $entry['staticpage'];
to

Code: Select all

            $entry = array('body' => $this->get_config('content'));
            serendipity_plugin_api::hook_event('frontend_display', $entry);
            echo $entry['body'];
Because the markup plugins operate on the array key 'body' (or 'extended') to find, where the text is stored in...

Thanks for the contribution, I think several people will find it useful :)

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/
romulus
Regular
Posts: 49
Joined: Fri Sep 24, 2004 4:31 pm
Contact:

Post by romulus »

thanks its working now :)

Additionally I have added an option to automatically output the text with article formatting (colors, background, borders, and so on).

Maybe you guys should think about to add something like this to 0.8 release, as I really think that coulde be useful for a lot of people.

Hint: to make a nicer URL for a static page you can add the following line to your .htaccess:

Code: Select all

RewriteRule ^pagetitle index.php?serendipity[subpage]=pagetitle
So instead to open this ugly URL http://www.yourblog.com/index.php?seren ... =pagetitle you can now open this nice one: http://www.yourblog.com/pagetitle
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

You could also spawn an external hook and then call:

http://www.yourblog.com/plugin/static_aboutme.html

:-)

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/
romulus
Regular
Posts: 49
Joined: Fri Sep 24, 2004 4:31 pm
Contact:

Post by romulus »

you guys are crazy, do you know that? Is there something s9y can't do? Admit it, there exists some hidden admin area where s9y can cook a perfectly brewed coffee, right?

;)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Well, when there's one thing I am most proud of, it's Serendipity's Plugin Architecture. :-)))

About the coffee-stuff - I don't do coffee, so I suppose someone else needs to implement that ;-)

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/
Little Hamster
Regular
Posts: 62
Joined: Thu Oct 07, 2004 3:16 pm

Post by Little Hamster »

Nifty plugin!

PS. All the discussions in this thread was so serious that I feel like butting in :D
romulus
Regular
Posts: 49
Joined: Fri Sep 24, 2004 4:31 pm
Contact:

Post by romulus »

no problem :)

I have just released version 0.3 (look into first post) and made an englisch info page in my blog: http://www.romulus23.de/s9y-plugins/staticpage-en
davecjr
Regular
Posts: 167
Joined: Fri Oct 29, 2004 3:09 pm
Contact:

Post by davecjr »

I was using the static page plugin in version 7 and upgraded s9y to 8 alpha 4 and now the static page shows up at the bottom of the main blog body page. Are there any easy fixes or anyone else using this having the same problem?

Thanks
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Sadly you need to upgrade that plugin. Please look here: http://cvs.sourceforge.net/viewcvs.py/p ... l_plugins/ for the latest version!

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/
Rembrandt
Regular
Posts: 71
Joined: Mon Dec 20, 2004 5:10 pm
Location: Germany
Contact:

Post by Rembrandt »

Hi!

I'm using s9y from the cvs branch and the static page plugin (also from cvs). The plugin works fine, but I want to use "fency" URIs like "http://www.mydomain.tld/static/[i]pagetitle[/i]. I followed the instructions from the plugin creator's homepage to rewrite the URI but at the bottom of the page, s9y places an error-message that the requested document doesn't exist.

TIA,
Rembrandt
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

The fancy URLs will only work when using mod_rewrite - do you use that?

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

Post by Guest »

Yes, I do.
And I put the following line in the .htaccess:

Code: Select all

RewriteRule ^static/(.*) /index.php?serendipity[subpage]=$1
The correct page is displayed - but with an error-msg from s9y.

so long...
Rembrandt

PS: You can see the error-msg at the bottom of plugin creator's homepage (http://www.romulus23.de/s9y-plugins/staticpage-en) ;)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Ah, okay - I see. I have fixed this issue in CVS, the error is not really usefull there.

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/
Rembrandt
Regular
Posts: 71
Joined: Mon Dec 20, 2004 5:10 pm
Location: Germany
Contact:

Post by Rembrandt »

garvinhicking wrote:Ah, okay - I see. I have fixed this issue in CVS, the error is not really usefull there.

Regards,

Garvin.
I've tried to find the error and looked in several files. Where was the error?
Post Reply