Some advanced(?) usage questions

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
ghoti
Regular
Posts: 19
Joined: Tue Dec 06, 2005 2:34 am
Location: Charlotte, NC
Contact:

Some advanced(?) usage questions

Post by ghoti »

Hi, I've been using s9y for some time for my blog, and I'm now trying to figure out if I can use it as a CMS for a complete website. I really like the features in the current 1.0 beta, and it gives me the right level of control (like selecting the virtual filename of static pages - which many others don't). So here are a few questions:
  • Is there a way to have s9y serve static pages for a whole site, but put the blog into a subdirectory /blog? I can't seem to find a way to set it up this way.
  • I've looked at the documentation for templates a bit, but it seems to be a bit incomplete - especially with regards to static pages. Is there a way to reference static pages by title (or some other means), and include their contents in a page? What I'm thinking about is building a homepage template that will show a few blog entries and then also have a "box" with stuff that I can change from the admin interface by editing a certain page.
  • In my current blog, I have an option "build cached entries" under Entries. That doesn't show up in my new installation, even when I install the simple caching plugin. Where does this come from? And does it also apply to static pages?
  • I'm a bit paranoid about relying on the database for each page visit. Is there a way to cache pages that stores them in files, so they can be shown even if the database can't be reached?
That's it for the moment ;) Thanks for all your efforts, I really appreciate it.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Some advanced(?) usage questions

Post by garvinhicking »

Hi!
Is there a way to have s9y serve static pages for a whole site, but put the blog into a subdirectory /blog? I can't seem to find a way to set it up this way.
No, Serendipity can only serve pages starting from the directory it is installed in. You can install Serendipity into the root of your directory, or you can use mod_rewrite or other redirection/embedding tricks for changing into that directory invisibly. But you'd need some PHP skill for that.
I've looked at the documentation for templates a bit, but it seems to be a bit incomplete - especially with regards to static pages. Is there a way to reference static pages by title (or some other means), and include their contents in a page? What I'm thinking about is building a homepage template that will show a few blog entries and then also have a "box" with stuff that I can change from the admin interface by editing a certain page.
Can you explain more detailed what you need? You can create custom Smarty functions that fetch and display static page contents via a smarty call in your .tpl file, if you like. Creating such a function would not be so hard, but to create that I'd need an actual example of what you want to do...
In my current blog, I have an option "build cached entries" under Entries. That doesn't show up in my new installation, even when I install the simple caching plugin. Where does this come from? And does it also apply to static pages?
This menu item comes frmo the "Extended Properties for Entries" plugin, when its caching is activated. It does not apply to static pages. It's only about caching blog entry contents so that markup transformations are not applied again for each visit.
I'm a bit paranoid about relying on the database for each page visit. Is there a way to cache pages that stores them in files, so they can be shown even if the database can't be reached?
Your paranoia is not necessary, the database is the best place for this. :-)

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/
ghoti
Regular
Posts: 19
Joined: Tue Dec 06, 2005 2:34 am
Location: Charlotte, NC
Contact:

Re: Some advanced(?) usage questions

Post by ghoti »

Garvin, thanks for your replies!
garvinhicking wrote:No, Serendipity can only serve pages starting from the directory it is installed in.
I think that's a misunderstanding. What I mean is that serendipity would be installed in the root directory of the site, and also serve pages from there. But the blog part would appear under the (virtual) directory /blog. I guess I could make a template that fetches blog entries and use that for a page in the blog directory, and change the paths for archives to blog/archives, etc. - would that work?
Can you explain more detailed what you need? You can create custom Smarty functions that fetch and display static page contents via a smarty call in your .tpl file, if you like. Creating such a function would not be so hard, but to create that I'd need an actual example of what you want to do...
Okay, I'll play around with that a bit more, and once I get stuck I'll ask a more concrete question.
This menu item comes frmo the "Extended Properties for Entries" plugin, when its caching is activated. It does not apply to static pages. It's only about caching blog entry contents so that markup transformations are not applied again for each visit.
Interesting, I have that plugin in my new installation, but don't see that option. Why does it only apply to blog pages? Static pages have markup too, and for a static-heavy site it would be very useful.
Your paranoia is not necessary, the database is the best place for this. :-)
I understand that, but I just had a database failure at my current hosting provider that lasted almost a day, and during that time it would be nice to at least see the content (even if stuff like commenting wouldn't work, obviously). Is there a way to catch a database connection error and display at least some "We're sorry" page?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Some advanced(?) usage questions

Post by garvinhicking »

Hi!
I think that's a misunderstanding. What I mean is that serendipity would be installed in the root directory of the site, and also serve pages from there. But the blog part would appear under the (virtual) directory /blog. I guess I could make a template that fetches blog entries and use that for a page in the blog directory, and change the paths for archives to blog/archives, etc. - would that work?
Ah, now I understand. Yes, using a "/blog" prefix as a virtual directory should work in that case!
Interesting, I have that plugin in my new installation, but don't see that option. Why does it only apply to blog pages? Static pages have markup too, and for a static-heavy site it would be very useful.
The caching first needs to be enabled in the extended properties plugin!

It can only cache entries because it uses the serendipity_entryproperties table which is only used by blogentries and not staticpages. Staticpages would need their own caching container for that.
I understand that, but I just had a database failure at my current hosting provider that lasted almost a day, and during that time it would be nice to at least see the content (even if stuff like commenting wouldn't work, obviously). Is there a way to catch a database connection error and display at least some "We're sorry" page?
Database failures are as probable as filesystem, so switching to a FS store wouldn't help you that much, honstely. However, s9y will not work without a database, in no case at all even with the simplecache plugin. s9y requires a Database, I'm sorry - changing that would mean a near total rewrite of Serendipity's framework. :-)

Of course a DB connection error could be caught; it currently emits the "DB Connection failed" error...

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/
ghoti
Regular
Posts: 19
Joined: Tue Dec 06, 2005 2:34 am
Location: Charlotte, NC
Contact:

Re: Some advanced(?) usage questions

Post by ghoti »

garvinhicking wrote:Ah, now I understand. Yes, using a "/blog" prefix as a virtual directory should work in that case!
But the "main page" for that would have to be done manually, right? I just played around with the path settings, but all I managed to do was screw up the styles, the blog would not appear under /blog.
The caching first needs to be enabled in the extended properties plugin!
It is ;) I even turned it off and on again, and no change.
Of course a DB connection error could be caught; it currently emits the "DB Connection failed" error...
That would have to be done in PHP, I guess? I'm not worried about the programming part, but about having to reapply my hacks every time I upgrade s9y.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Some advanced(?) usage questions

Post by garvinhicking »

Hi!

Yes, the main page would need to be done manually (or with PHP code of course). How did you play with your path settings exactly?

I have never tried that prefixing thing, so it might be that this causes trouble because it matches the serendipityHTTPPath settings to get the root of the blog directory...I don't really know. :)
It is ;) I even turned it off and on again, and no change.
Hm, it shows up here for me when caching is enabled. Maybe your user doesn't have the full permissions? Caching is only shown to Admins, AFAIK.
That would have to be done in PHP, I guess? I'm not worried about the programming part, but about having to reapply my hacks every time I upgrade s9y.
This missing DB connection error is already part of s9y, but of course it's just a plain message and not fit within your blog layout or something like that (of course not, because without a DB connection s9y does not know which template to use ;-)

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/
ghoti
Regular
Posts: 19
Joined: Tue Dec 06, 2005 2:34 am
Location: Charlotte, NC
Contact:

Re: Some advanced(?) usage questions

Post by ghoti »

garvinhicking wrote:How did you play with your path settings exactly?
I just randomly changed some of them ... didn't really expect it to work, to be honest.

What would be cool would be to have the blog path as a standard feature. With serendipity getting more and more features, more people will want to build stuff around their blog with it.

But I will try to do the manual blog page thing in the next days and let you know if it works.
Hm, it shows up here for me when caching is enabled. Maybe your user doesn't have the full permissions? Caching is only shown to Admins, AFAIK.
There's only one user, and he's an admin. I can switch it on and off on my old installation, but not the new one. Hm.
This missing DB connection error is already part of s9y, but of course it's just a plain message and not fit within your blog layout or something like that (of course not, because without a DB connection s9y does not know which template to use ;-)
Would it be possible to do this as a plugin? I just looked through the plugin API quickly, but there doesn't seem to be a hook for that.

Thanks,

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

Re: Some advanced(?) usage questions

Post by garvinhicking »

Hi!
What would be cool would be to have the blog path as a standard feature. With serendipity getting more and more features, more people will want to build stuff around their blog with it.
Why not rename "archives" to "blog" then? I think that should work for the distinction of the website?
There's only one user, and he's an admin. I can switch it on and off on my old installation, but not the new one. Hm.
Which s9y version is it exactly, where this does not work? And which version of the entryproperties plugin is used?
Would it be possible to do this as a plugin? I just looked through the plugin API quickly, but there doesn't seem to be a hook for that.
As I said, the s9y framework cannot be laoded without a DB connection. Without DB, no plugin API can be loaded. :-)

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/
ghoti
Regular
Posts: 19
Joined: Tue Dec 06, 2005 2:34 am
Location: Charlotte, NC
Contact:

Re: Some advanced(?) usage questions

Post by ghoti »

garvinhicking wrote:Why not rename "archives" to "blog" then? I think that should work for the distinction of the website?
That was easy ;) Yes, that works very well. The only thing that doesn't work with that prefix is the archives. It wants to show me the posts from 1969, but I really didn't post much back then. That's not a big problem though, I may not use the monthly archives at all.
Which s9y version is it exactly, where this does not work? And which version of the entryproperties plugin is used?
I have two clean installs of 1.0-beta3 where it doesn't work, it only works in the one that I upgraded from 0.9.1 (and which I started about a year ago at 0.8 or whatever was current back then).
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Some advanced(?) usage questions

Post by garvinhicking »

Hi!

The "1969" problem can happen if some "slashes" are misaligned and paths settings are not properly ending with a "/"...
I have two clean installs of 1.0-beta3 where it doesn't work, it only works in the one that I upgraded from 0.9.1 (and which I started about a year ago at 0.8 or whatever was current back then).
Hm, that's really strange. Are there any files that differ frmo the two releases? Maybe you could try to check your authorgroups and groucpnfig tables and see if they differ in specific aspects?

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/
Post Reply