Msg#: 4392591 posted 5:45 pm on Nov 30, 2011 (gmt 0)
I'm looking in to adding template support in my software and I'd like some insight from others how they would or even have implemented it. I'm talking more in the context of conceptual, not the actual MySQL structure at least directly such as field types unless someone considers that relevant to the conceptual aspects.
Here are my current notes...
type: header,footer? standalone?
Standalone might be in example a small part of the page for advertising, e.g. it's root most element is completely contained inside of that template item.
Type would be header or footer though it might be something else.
Validity is (X)HTML related, if it's not been validated it can't be used. I think I might have a second XHTML field for updates pending re-validation.
My goal is to have the template system as flexible as possible and even include the ability to have several template items be used simultaneously on a single page for modularity.
...and I'm not using third party software however I have nothing against considering good features of other people's software.
Msg#: 4392591 posted 4:46 pm on Dec 1, 2011 (gmt 0)
You might have a look at how modX does it. You can create templates, but they are minimal because they are often incorporated with another resource, "chunks." Chunks can be anything, but they are static (headers, footers, redundant data. . . .) Enter third resource, "snippets" that allows you to incorporate small PHP snippets that are evaluated and executed - for anything not covered by a plugin.
So you can have a plugin that outputs menus (getResources, among other things) and put a call to the plugin inside a chunk, and reference the chunk in the template.
Enter a fourth resource, template variables, which are similar (but far superior) to Wordpress "custom fields." You assign the T.V.'s to a given template, and they become available to any document resource using that template. For example, "main page" TV's would have different functions that internal page TV's.
modX is truly a coder's CMS, bcause it's so customizable with short PHP snippets, but once set up is easy beans for the non-tech personnel managing it. It has it's down sides but still better than most O.S. wares out there.
Msg#: 4392591 posted 8:52 pm on Dec 1, 2011 (gmt 0)
Thanks rocknill. I've decided to go with a single template "set" per page and then allow however many template "items" to be added to any given "set". The template set is a list with content where items be can arranged before or after the content item without a limit to the number of template items added to a template set. It's a very simple yet powerful way I think to allow flexibility. Your input helped, thank you very much! :)