A simple option: Placeholder variables

virtcert <[email protected]> 6 Sep 2003 03:29:04 -0000
Newsgroups gmane.comp.web.oscommerce.devel
Message-ID <a0b5c61a3646610e5e2d0a6245b22d6a@osCommerce-Forums>
This message was sent from: Development
http://forums.oscommerce.com/viewtopic.php?p=225063#225063
----------------------------------------------------------------

I use a simple template system on my current service, DiamondSea.com.  I would like something equally simple for OSC.  Basically, I have an HTML Template Form which has variables placed where I want specific content to go.  For example, here are sample template pages that I use on my system now:

Template Page:
   http://search.diamondsea.com/writable/107-results-1.html
   http://search.diamondsea.com/writable/107-results-2.html

Are used to generate these pages, respectively:
   http://snurl.com/demodia2
   http://snurl.com/demodia1

Notice how the body of the document is represented by the simple tag "$output" in the first example, and in the second example, more detail fields are used to better "sculpt" the layout wanted.

This makes it very easy for the end user to customize their look and feel without having to touch a bit of PHP code.  I figure that this would require modifying pretty much every major fine in the system, but it would make it actually useful for the non-webmaster to use.
I would like to be able to upload a simple HTML file as a site-wide template and be able to place variables like
   $body (the center portion of the page where the content changes)
   $catbox (categories box)
   $manbox (manufacturers box)
   $newbox (what's new box)
   $findbox (quick find box)
    .... and so on

This would allow me to easily customize any look and feel by changing a single HTML file that could be uploaded anywhere on my server (in a user directory for example, protecting the OSC code base).

This would be a good bit of legwork going through the code and changing "echo" statements to "$varname = " statements, but would be very important and useful to me (and probably all OSC users).

Does this make sense? 

I am probably going to hack something like this up for MS2 for my own use, because all of the current templating systems are too complex or dangerous (User modifying PHP code?  ARGH!!  Expect utter destruction to quickly follow!)

You could then upload a simple HTML file that could be viewed by simply browsing to it's URL to view in "source form" and could be listed as a simple Define in one of the configure.php files with the file's path.

Would this be a problem to implement in the CVS code base?

My 2 cents,

   - Brian