Welcome to WebmasterWorld Guest from 54.162.226.212

Forum Moderators: open

Message Too Old, No Replies

How would you setup XHTML templates in MySQL?

     
5:45 pm on Nov 30, 2011 (gmt 0)

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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...

cms_template_sets
_________________

id
name

validated?


cms_template_templates
_________________

id
name

type: header,footer?
standalone?

validated?
xhtml


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.

Thoughts please?

- John
4:46 pm on Dec 1, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.
8:52 pm on Dec 1, 2011 (gmt 0)

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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! :)

- John
 

Featured Threads

Hot Threads This Week

Hot Threads This Month