RE: Template System

iiinetworks <[email protected]> 31 Jul 2003 02:48:24 -0000
Newsgroups gmane.comp.web.oscommerce.devel
Message-ID <78608f124b269043802851d7f1ad7c2b@osCommerce-Forums>
This message was sent from: Development
http://forums.oscommerce.com/viewtopic.php?p=204842#204842
----------------------------------------------------------------

No, an engine takes content and wraps it in layout and theming to make pages.  In other words, an engine merges content with layout and theming.  

A structure is just a way of writing content, layout, and theming so that singular changes propagate across multiple pages.  Part of this involves separating content from layout and theming.  This allows the modularization of the layout and theming.  Thus, if you set up a site as three column, you can later switch easily to two column across all pages.  By contrast, the current system would require you to manually change every main page to hold the new layout.  Header, footer, and columns already mostly work like this.  The same files provide them for all pages.

An engine is something that you do once and then have pages that are much like what osCommerce has now.  A structure is actively maintained.  With an engine, if I make a change I have to rebuild all the pages that it effects.  With a structure, if I make a change it takes effect immediately.

To the user, both have similar effect, but from a developer's perspective, they reach it differently.  An engine does all the work at the beginning, so it must be repeated after making changes.  A structure works at runtime, so no additional work needs to be done after a change.  Thus, a structure is easier to tweak and also allows for end user (customer) customization.

Writing a Template Engine interface will be easier after a Template Structure is created to separate content from layout and theme.  Then the layout and theme can be edited as a template (with hooks) and applied to the content by an engine.  This is unlikely to be done by a core developer.  More likely, these interfaces (people won't choose just one; Smarty may be this thread's favorite, but someone else will insist on phpNuke, etc.) will be added by various contributors, like payment modules.

Hth,
Matt