Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Is there an elegant way to make site-wide static content manageable?


Reply


4 Posts   1092 Views

Avatar
SilverRay

Community Member, 167 Posts

8 January 2009 at 4:14pm

Edited: 08/01/2009 4:16pm

Hi there again,

In many sites, there's content that is sort of static, but sometimes needs to be updated. You know, things like headers above lists of links that are the same on every page, footers, etc. I can use includes to make them editable in one place, but that would not really be easily accessible to a site author (the user of the CMS I mean). I'm looking to find a way to make these things appear in the CMS. I was thinking of setting up "secret" pages to manage these things, or perhaps use a dataobject and a many_many relationship, just with one long row of name-value pairs, but for things that perhaps change a few times a year, it seems overkill to use control blocks (and hence more db calls every time) on every page just to show almost static information. Any thoughts?

Thanks!

Avatar
Fuzz10

Community Member, 787 Posts

9 January 2009 at 1:08am

I usually add a new tab in the UI for the homepage and stick all the configurable stuff under there.

Avatar
UncleCheese

Forum Moderator, 4094 Posts

9 January 2009 at 3:47am

This is a really interesting point. I think the only way you could really do it is to make those values properties of the home page, and when you want to get that nav header, for instance, you could just do a singleton('HomePage')-NavHeader call.

If you want different values on every page, then I think a tablefield is the way to go. A type dropdown in one column and a value in the other e.g. Contact-Us || NavHeader here

The most logical answer is to use static vars, of course, but your authors don't have access to PHP.

Avatar
SilverRay

Community Member, 167 Posts

12 January 2009 at 2:05pm

Edited: 12/01/2009 2:06pm

Yeah, I was thinking about the home page option too. The table option is of course useable for different headers on every page, but I want the same... Btw, as a related subject, the headers I'm talking about are headers for list of links in the footer (you see this often nowadays in sites). The links themselves are also the same on every page, and I do that with something loosely based on this:

http://doc.silverstripe.com/doku.php?id=recipes:page_selection_for_special_menu

(I thought maybe that helps someone.)

Thanks for your thoughts!