Community Add-Ons
Simple Template System (STS) 1.0
for osCommerce Online Merchant v2.2
Simple Template System (STS).
The Simple Template System (STS) lets you create simple HTML templates to customize the look and feel of OSC.
Simply create an HTML page that looks the way you want it to and put in placeholders for the various elements wherever you want to position them.
Below is a link to a sample Template page that generates a page similar to the default OSC settings. It uses bordered tables to help visually lay out the page and debug the output. In a production template, you can hide the borders, add more stylesheet formatting, etc.
http://www.diamondsea.com/osc/sts/template.html
For example, you would put "$cartbox" wherever on the page you want the Shopping Cart box to appear. Put "$categorybox" where you want the Categories box to appear. Put "$content" wherever you want the main page content (the central part where all the magic happens) to appear, etc.
It does this by changing only a few /catalog/includes/ files, leaving all other files untouched, making it easy to add other contributions later.
Information, questions and comments about STS should be posted to this thread, to provide a simple method of tracking and to make sure I actually get notified of your message (I don't lurk here much).
This was designed to be simple enough for even newbie webmasters to be able to set up in a couple minutes. I hope you will find this helpful.
- Brian Gallagher
Designed for 2.2MS2, but will probably work for any of them.
This addon is ONLY for people who want this feature. It was done using STS version 2.01
File just contains the information below. It's a rar file disguised as a zip file.
What it does
============
Basically it will use generic templates that you want to use for a category and all it's subcategories it.
Example: cPath=1_11_21_31
First it will check if there's a file called: "index.php_1_11_21_31.html"
If there isn't then it'll check for:
""index.php_1_11_21.html"
and so on.
So if you just want 1 generic template for category "1" and all it's subcategories you would just create a index.php_1.html file. All subcateroies of this category will load this template (unless there are templates for the subcategories)
If you want a generic template for 1_11 you'd create a index.php_1_11.html file, and so on.
Simple install:
OPEN
/includes/sts_display_output.php
FIND: (around line 108)
if (file_exists($sts_check_file)) {
// Use it
$sts_template_file = $sts_check_file;
}
ADD AFTER
// Check to see if there are universal templates for parent categories
else {
// get all subcategories and parent category
$sts_all_cats = explode("_", $sts_cpath);
$num_all_cats = count($sts_all_cats);
// Load nearest parent category to the child
for ($i=1; $i<$num_all_cats; $i++) {
array_pop($sts_all_cats);
$sts_cpath = implode("_", $sts_all_cats);
$sts_check_file = STS_TEMPLATE_DIR . "index.php_$sts_cpath.html";
if (file_exists($sts_check_file)) {
// Use it
$sts_template_file = $sts_check_file;
$i=$number_of_cats;
}
}
}
That's it.
BACKUP YOUR FILES FIRST. It hasn't been tested long enough to be considered bug proof.
Enjoy!
