simple staticpage plugin

Creating and modifying plugins.
Post Reply
User avatar
onli
Regular
Posts: 2266
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

simple staticpage plugin

Post by onli » Thu Nov 29, 2012 9:58 pm

I made a simple staticpage-plugin. It is probably indeed too simple to exchange the original with it. It needs testing, especially with mod_rewrite. And so far, it has no styling apart from some classnames and ids. Will only work with smarty 3, so it needs s9y 1.7.

But: Fully smartified, easy workflow, no clutter, easy to enhance (270 loc).

Image
Image
Image
Attachments
serendipity_event_simple_staticpage.tar.gz
(3.8 KiB) Downloaded 198 times

mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 10:35 pm
Location: Wiesbaden, Germany
Contact:

Re: simple staticpage plugin

Post by mattsches » Sat Dec 01, 2012 12:11 am

Hi, I just read your blog post and I will try to test it, but not in the next couple of days, sorry. Maybe we can talk about during the dev sprint.

User avatar
yellowled
Regular
Posts: 7084
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: simple staticpage plugin

Post by yellowled » Sat Dec 01, 2012 1:33 pm

All I'm about to write may sound stupid, be technically not feasible and/or is by no means meant as criticism towards the simple static page plugin (which I haven't tested yet). Bear with me. :)

Can't we just “re-use” functionality which is currently used for entries to create static pages? I mean, basically a static page is not that different from an entry. A static page is supposed to have a title and an url created from the title. It also has a publishing date, content (entry) and pre-content (extended entry). We could even use the category functionality to assign categories with static pages. Obviously, static pages don't need most of the features provided for entries by plugins like tags, extended properties etc., but the only actual difference (as far as I can see right now) is the fact that static pages are not ”presented” in a chronological order.

Does that make any sense at all?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
onli
Regular
Posts: 2266
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: simple staticpage plugin

Post by onli » Sat Dec 01, 2012 1:45 pm

That makes sense, I thought about it.

The difference between static pages and entries I saw is exactly that some things are not needed, especially that the page is not in a context sorted by date. The URL shall look like a stable URL and can be/should be easy to add to the template-navigation. And the not-needed things are which make it easy to write such a plugin, I for example removed the pre-content on purpose (which function does it serve on a static page? None at all, as far as i can see).

We could probably save a staticpage as an entry with a specific publish-status or something else which hides it when fetching normal entries. But given the plugin-code to talk to the database is really not long (4 short functions), i don't see that big an advantage in this.

User avatar
yellowled
Regular
Posts: 7084
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: simple staticpage plugin

Post by yellowled » Sat Dec 01, 2012 7:43 pm

onli wrote:The difference between static pages and entries I saw is exactly that some things are not needed, especially that the page is not in a context sorted by date.
Sure, but it's still supposed to have a date (as “last edited”).
onli wrote:But given the plugin-code to talk to the database is really not long (4 short functions), i don't see that big an advantage in this.
I have no idea whether that would be an advantage, I just thought I'd mention it. Also, if it's not a plugin, it wouldn't need to be installed seperately. It sort of would be “in the core by default”.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
onli
Regular
Posts: 2266
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: simple staticpage plugin

Post by onli » Mon Dec 10, 2012 1:42 am

A remark: I just got notified that my static pages where not working, showing my projects and such. And indeed: they didn't work. What happened was that they were set to be a draft. I never noticed.

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: simple staticpage plugin

Post by Don Chambers » Mon Dec 10, 2012 6:21 pm

Seems for a very long static pages were viewable by all regardless of draft/publish status. Many people, me included, had several static pages with a draft status. Some fix to the static page plugin not long ago corrected this behavior - draft static pages were no longer viewable until published, as they never should have been.

User avatar
onli
Regular
Posts: 2266
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: simple staticpage plugin

Post by onli » Mon Dec 10, 2012 6:42 pm

Which explains why I didn't notice when making those pages. That fix wasn't such a good idea -.-

Anyway, there is a lesson here for the simpler version of the plugin: Draft-state shouldn't exist in this form or be very noticeable.

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

Re: simple staticpage plugin

Post by garvinhicking » Tue Dec 11, 2012 2:37 pm

Drafts are IMO a very important feature so that you can hide pages. IMO this is not optional for a future 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/

User avatar
onli
Regular
Posts: 2266
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: simple staticpage plugin

Post by onli » Tue Dec 11, 2012 7:20 pm

If that be so, that status should be very noticeable - specific styling on the page itself and an icon or specific placement on the backend.

But as the pages are listed nowhere in the frontend, which function fulfills that status?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: simple staticpage plugin

Post by Timbalu » Tue Dec 11, 2012 8:21 pm

garvinhicking wrote:...not optional for a future plugin...
What does that mean? Did I miss something? Is there an agreement to drop the old staticpage plugin and write a new one?
If someone heads there... I have to state that I would prefer to stick with the old and modernize it via a really simple template (something like the one Malte has in mind) and rename the current 'simple template' to more specific 'all field (structured)' template, or put the whole staticpage functionality into core.

Btw, I can't find any fixes of draft in last commit hist... or is the added $is_staticpage var meant?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

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

Re: simple staticpage plugin

Post by garvinhicking » Fri Dec 14, 2012 1:20 pm

But as the pages are listed nowhere in the frontend, which function fulfills that status?
But that's exactly the reason; people would need to be able to temporarily disable static pages if they need to work on it or if they are not yet finished.

I agree, the status indicator could be much more visible.

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
onli
Regular
Posts: 2266
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: simple staticpage plugin

Post by onli » Fri Dec 14, 2012 1:45 pm

Ok, temporary disabling, especially after the page was online before, is a very valid usecase. Will be included.

Post Reply