static page plugin

Creating and modifying plugins.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

index.php - the "else" case where it emits a 404 header and then printf()s the DOCUMENT_NOT_FOUND message. That one can be removed, as it was in wrong layout already.

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:index.php - the "else" case where it emits a 404 header and then printf()s the DOCUMENT_NOT_FOUND message. That one can be removed, as it was in wrong layout already.

Regards,
Garvin
Ah, then I looked at the right section. Nice to know for the next time ;)

Thx,
Rembrandt (a s9y user for two days)
Rembrandt
Regular
Posts: 71
Joined: Mon Dec 20, 2004 5:10 pm
Location: Germany
Contact:

Post by Rembrandt »

Hmm, one (last) question: Why did you parse the URI in index.php? I thought, the URI will be rewritten in .htaccess?

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

Post by garvinhicking »

The URI needs to be parsed because index.php is the ErrorDocument ApacheHandler. Internally we just catch 404 errors and then deliver the page which was originally requested, to provide the "pretty URLs". To stay compatible mod_rewrite uses the same mechanism but without reating a 404 error.

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 »

Is there a possibility to avoid the 404-ResponseHeader (for my /static/"pagename" - problem) without inserting a match-rule in index.php?

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

Post by garvinhicking »

Yes, the plugin just needs to emit a header('HTTP 1/0. 200') by itself to override the previous 404 header...

So it must be changed in the plugin...

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:Yes, the plugin just needs to emit a header('HTTP 1/0. 200') by itself to override the previous 404 header...

So it must be changed in the plugin...

Regards,
Garvin.
Done!

Before:

Code: Select all

function generate_content(&$title) {
        $title = STATICPAGE_TITLE.' ('.$this->get_config('pagetitle').')';
        (...)
}
After:

Code: Select all

function generate_content(&$title) {
        header('HTTP/1.0 200');
        $title = STATICPAGE_TITLE.' ('.$this->get_config('pagetitle').')';
}
And now it works. *g*

so long...
Rembrandt

PS: I've to take a close look to your plugin-api - seems to be very nice!
E. Bess
Regular
Posts: 12
Joined: Mon Dec 20, 2004 10:41 pm
Location: Brooklyn, NY

Post by E. Bess »

Hi there --

I posted a question about static pages over in the general forum and someone pointed me in the direction of this plugin. Yay!

There's only one problem: I don't see it showing up in the event plugins dropdown menu. Boo!

Any idea as to what the problem is? I thought that just sticking it in that directory would be enough to make it work, but perhaps there's something else I need to configure?

Also, if I want more than one static page, how would I accomplish that?

Thanks muchly. I'm diggin' Serendipity something fierce.
E. Bess
Regular
Posts: 12
Joined: Mon Dec 20, 2004 10:41 pm
Location: Brooklyn, NY

Post by E. Bess »

I should also add that I installed the plugin exactly as romulus said: unzipped the plugin into the plugins folder. I did notice that supposedly plugins are supposed to sport a "serendipity_" prefix while this one is named "romulus_". I tried renaming the folder and the file to reflect those conventions, but it didn't work (I got an error on my plugin administration page). I tried renaming the folder, file and name of the function in the file, but that didn't work either -- it still doesn't show up in the dropdown menu.

I really, really would love to use this plugin, so if you have any ideas, please let me know.

Thank you!

Oh! And I'm running the latest: 0.7.1 (just downloaded it today).
E. Bess
Regular
Posts: 12
Joined: Mon Dec 20, 2004 10:41 pm
Location: Brooklyn, NY

Post by E. Bess »

Ah -- permissions problem. Works totally fine.

Man, I must've been asleep at the wheel last night....
veggie2u
Regular
Posts: 12
Joined: Fri Jan 07, 2005 7:44 pm
Location: Minneapolis
Contact:

Post by veggie2u »

I have serendipity .7 with the .3 version of the static plugin.

I can configure the plugin, but when I try to goto the page, it is just blank. If I try to goto a page not created, it returns me to the blog, so it appears like the plugin is doing somehting, just not returning the text for the static page.

Any ideas?

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

Post by garvinhicking »

Veggie: Do you have a URL to the page where it doesn't work? By .3 version, do you mean the latest version of our CVS additional_modules? You should use that one...

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/
veggie2u
Regular
Posts: 12
Joined: Fri Jan 07, 2005 7:44 pm
Location: Minneapolis
Contact:

Post by veggie2u »

I am not using CVS. I am a coder for a living, and my groups CVS code is far from stable :) I can try the cvs version though.

By version .3, I meant the one I downloaded off the s9y site under plugins just a couple of days ago. Inside the script is says version .3

You can see the page I tried to get working here:

http://www.cyberward.net/blog/index.ph ... =testPage

I am not certain I have the mod_rewrite working yet. Once I have the url's above working, I will get the /blog/static/testPage to work.

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

Post by garvinhicking »

Please try to download http://cvs.sourceforge.net/viewcvs.py/p ... taticpage/
and try it with the CVS version; I think it may work 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/
veggie2u
Regular
Posts: 12
Joined: Fri Jan 07, 2005 7:44 pm
Location: Minneapolis
Contact:

Post by veggie2u »

I guess I am not sure where I found the version of .3. Anyway, I installed the cvs version called 1.3. I did a diff :

Code: Select all

diff serendipity_event_staticpage.php serendipity_event_staticpage_cvs.php
100a101,104
>         if (!headers_sent()) {
>             header('HTTP/1.0 200');
>         }
>
Not much different. Anyway, same result. I tried to make another page, called "chris". Same thing.

I am using .7 of serendipity, should I try a different version?
Post Reply