Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted (edited)

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.

 

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

Edited by Johnson
  • Replies 74
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Simple Template System (STS) 1.0

Contribution Author: Brian Gallagher @ DiamondSea.com

Contribution Author Email: [email protected]

 

If you like this contribution please donate to the osCommerce core team at

http://www.oscommerce.com/about/team

Without their incredible work, I wouldn't have been able to build on such

a strong foundation. Thank you!

 

-----------------------------------------------------------------------------

WHAT IT DOES:

-----------------------------------------------------------------------------

Lets you create simple HTML templates to customize the look and feel of OSC.

 

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

 

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.

 

-----------------------------------------------------------------------------

HOW TO INSTALL:

-----------------------------------------------------------------------------

 

Over a clean OSC 2.2MS2 install, just copy the following files into your

/catalog/includes directory.

 

application_top.php

header.php

column_left.php

column_right.php

footer.php

application_bottom.php

template.html

 

NOTE: configure.php is included in the ZIP file, but you will have to

reenter all your configuration settings if you replace it. It is easier

to just add the following lines to the bottom of

/catalog/includes/configure.php:

 

//****************************************************************

// BG: BGI: 09/05/2003: Add Simple Template System Code

define('DIR_WS_TEMPLATE', DIR_WS_INCLUDES . 'template.html');

//****************************************************************

 

 

-----------------------------------------------------------------------------

HOW TO USE:

-----------------------------------------------------------------------------

 

Just modify the

 

/catalog/includes/template.html

 

file to look however you want. Use stylesheet settings or HTML setting to

provide a custom look and feel to your site and arrange elements wherever you

like them.

 

-----------------------------------------------------------------------------

SUPPORTED TAGS:

-----------------------------------------------------------------------------

Here are the tags that are supported so far (more sure to come in later

versions):

 

$headcontent: Put this string in your <head> section so that it can insert

the dynamic head content and javascript on pages that require it. This will

probably require putting the $headcontent in the <head> section in the source

code. It's a pain to do it this way, but it was the only way I could get it

working. Sorry!

 

$cataloglogo: The OSC logo and link

$urlcataloglogo: The URL used by the $catalog logo.

$myaccountlogo: The MyAccount graphic and link

$urlmyaccountlogo: The URL used by the My Account function

$cartlogo: The Cart graphic and link

$urlcartlogo: The URL used by the Cart function

$checkoutlogo: The Checkout graphic and link

$urlcheckoutlogo: The URL used by the Checkout function

$breadcrumbs: The "Top > Catalog > whatever..." breadcrumbs text and links

$myaccount: The text version of "My Account" and link. Changes to "Logoff" if logged on.

$urlmyaccount: The URL used by the MyAccount function.

$cartcontents: The text version of the "Cart Contents" function.

$urlcartcontents: The URL used by the MyAccount function.

$checkout: The text version of the "Check Out" function.

$urlcheckout: The URL used by the "Check Out" function.

 

$categorybox: The Category box

$manufacturerbox: The Manufacturer box

$whatsnewbox: The What's New box

$searchbox: The Search box

$informationbox: The Information box

$cartbox: The Shopping Cart box

$maninfobox: The Manufacturer Info box (blank if not used on a page)

$orderhistorybox: The Order History box (blank if not used on a page, ie: use not logged in)

$bestsellersbox: The Best Sellers box

$specialfriendbox: Either the Specials box or the Tell A Friend box (depending on page viewed)

$reviewsbox: The Reviews box

$languagebox: The Languages box

$currenciesbox: The Currencies box

$content: The main content of the page (the middle of the page)

$date: The current date

$numrequests: The "XXX requests Since DATE" text

$counter: The page view counter

$footer: The footer output from footer.php

$banner: The banner output from footer.php

-----------------------------------------------------------------------------

DEBUGGING:

-----------------------------------------------------------------------------

 

In the /catalog/includes/application_bottom.php file you can see the

following settings (near the top of the file):

 

$display_template_output = 1;

$display_normal_output = 0;

$display_debugging_output = 0;

 

Display_Template_Output (the default setting) will cause it to display the

template versions of the pages.

 

Display_Normal_Output will cause it to display the non-template version of

the pages.

 

Display_Debugging_Output will cause it to display debugging information

showing all of the blocks of data that it is using and how it translates

them into template variables.

 

You can use any or all of the settings in any combination. If you have both

Normal and Template output, the Template output will be displayed first.

 

-----------------------------------------------------------------------------

SUPPORT:

-----------------------------------------------------------------------------

 

For support, please post to the Simple Template System thread here:

 

http://www.oscommerce.com/forums/viewtopic.php?t=57749

Posted

AWESOMEEEEE template System !!! Thanks...

AWESOMEEEEE template System !!! Thanks...

AWESOMEEEEE template System !!! Thanks...

AWESOMEEEEE template System !!! Thanks...

 

really thanks...

 

Next step... make the same system to product_listing.php & product info.php to be more configurable... we need them.

 

We love you Brian!!!!!!!!!!!!!!! :) you make us happy!

 

THANKS from SPAIN!!!

Posted
Psss - I will let you in on a little secret...  you can down load it here:

 

:arrow: http://www.oscommerce.com/community/contributions,1506

 

:wink:

 

Thanks! I knew I forgot something! :oops:

 

- Brian

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Posted
Next step... make the same system to product_listing.php & product info.php to be more configurable... we need them.

That will probably be my next project. However, as this is the first thing I've done with OSC (I'm not even using it yet) I figured I'd start small. :wink:

 

Personally, I hate the "Click here for a big version of the image" popups (I debated not even fixing the popup code so people wouldn't use it :twisted: ). I'm probably move the image to the right side and have larger images below the descriptive test. But either way I want to make it more configurable.

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Posted

Moved from General Support Forum

Post subject: Simple Template System (STS) 1.0):

Hi, your script is wonderful but after installation, "contact_us.php" module don't work! please help

Thanks!

 

I'm glad you like it! Here's the fix:

 

Add the second block of code below into the strip_content_tags() function down near the bottom of application_bottom.php:

 

// STRIP_CONTENT_TAGS() - Remove text before "body_text" and after "body_text_eof"

function strip_content_tags($tmpstr, $commentlabel) {

 // Now lets remove the <tr><td> that the require puts in front of the tableBox

 $tablestart = strpos($tmpstr, "<table");

  $formstart = strpos($tmpstr, "<form");

 

 // If there is a <form> tag before the <table> tag, keep it

 if ($formstart < $tablestart) {

    $tablestart = $formstart;

 }

  // If empty, return nothing

 if ($tablestart < 1) {

       return  "n<!-- start $commentlabel //-->n$tmpstrn<!-- end $commentlabel //-->n";

 }



 $tmpstr = substr($tmpstr, $tablestart); // strip off stuff before <table>

 

 // Now lets remove the </td></tr> at the end of the tableBox output

 // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos

 $tmpstr = strrev($tmpstr);



 $tableend = strpos($tmpstr, strrev("</table>"), 1);

 $tmpstr = substr($tmpstr, $tableend);  // strip off stuff after <!-- body_text_eof //-->



 // Now let's un-reverse it

 $tmpstr = strrev($tmpstr);

 

 // print "<hr>After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[".  htmlspecialchars($tmpstr) . "]<hr>n";

 return  "n<!-- start $commentlabel //-->n$tmpstrn<!-- end $commentlabel //-->n";

}

 

I'll wait a couple days for people to find any more bugs and then I'll put up an updated contribution with the fixes added.

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Posted
Another... setup is to make... a zone in your template system for LOGIN users...

 

The login system in the header line or bottom line...

 

I'm not sure what you mean by these. Can you explain a little more what you want?

 

- Brian

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Posted

I hate it when I mess up the fixes... I left out the ($formstart !== false) check.

 

Here's the corrected version of the updated strip_content_tags() function.

 

// STRIP_CONTENT_TAGS() - Remove text before "body_text" and after "body_text_eof"

function strip_content_tags($tmpstr, $commentlabel) {

 // Now lets remove the <tr><td> that the require puts in front of the tableBox

 $tablestart = strpos($tmpstr, "<table"); 

 $formstart = strpos($tmpstr, "<form");

 

 // If there is a <form> tag before the <table> tag, keep it

 if ($formstart !== false and $formstart < $tablestart) {

    $tablestart = $formstart;

 }  

 

 // If empty, return nothing

 if ($tablestart < 1) {

       return  "n<!-- start $commentlabel //-->n$tmpstrn<!-- end $commentlabel //-->n";

 }



 $tmpstr = substr($tmpstr, $tablestart); // strip off stuff before <table>



 // Now lets remove the </td></tr> at the end of the tableBox output

 // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos

 $tmpstr = strrev($tmpstr);



 $tableend = strpos($tmpstr, strrev("</table>"), 1);

 $tmpstr = substr($tmpstr, $tableend);  // strip off stuff after <!-- body_text_eof //-->



 // Now let's un-reverse it

 $tmpstr = strrev($tmpstr);



 // print "<hr>After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[".  htmlspecialchars($tmpstr) . "]<hr>n";

 return  "n<!-- start $commentlabel //-->n$tmpstrn<!-- end $commentlabel //-->n";

}

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Posted

Yes DiamondSea...

 

I meant that in your template.html you can put the login Boxes IN the header line...

 

Name: (input) Password: (input hidden) Button Login.

 

 

Simple, but not for us...

 

Please can you make the login line for your template system? There are infoboxes that do that, but is not the same,we wants it... at the header line, very fast to visualize it! you understand me?

 

The infobox login is here: http://www.oscommerce.com/community/contributions,1469 <--- the heavy one....

 

A simple infobox is here, with the 2 required inputs : http://www.oscommerce.com/community/contributions,590

 

Thanks man for your work...

Posted

And yes... we hate the actual product_info.php and product_size.php structures...

 

We need a mod from them... :) or a template system like this...

Posted
Moved from General Support Forum

Post subject: Simple Template System (STS) 1.0):

Hi, your script is wonderful but after installation, "contact_us.php" module don't work! please help

Thanks!

 

I'm glad you like it! Here's the fix:

 

Add the second block of code below into the strip_content_tags() function down near the bottom of application_bottom.php:

 

// STRIP_CONTENT_TAGS() - Remove text before "body_text" and after "body_text_eof"

function strip_content_tags($tmpstr, $commentlabel) {

 // Now lets remove the <tr><td> that the require puts in front of the tableBox

 $tablestart = strpos($tmpstr, "<table");

  $formstart = strpos($tmpstr, "<form");

 

 // If there is a <form> tag before the <table> tag, keep it

 if ($formstart < $tablestart) {

    $tablestart = $formstart;

 }

  // If empty, return nothing

 if ($tablestart < 1) {

       return  "n<!-- start $commentlabel //-->n$tmpstrn<!-- end $commentlabel //-->n";

 }



 $tmpstr = substr($tmpstr, $tablestart); // strip off stuff before <table>

 

 // Now lets remove the </td></tr> at the end of the tableBox output

 // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos

 $tmpstr = strrev($tmpstr);



 $tableend = strpos($tmpstr, strrev("</table>"), 1);

 $tmpstr = substr($tmpstr, $tableend);  // strip off stuff after <!-- body_text_eof //-->



 // Now let's un-reverse it

 $tmpstr = strrev($tmpstr);

 

 // print "<hr>After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[".  htmlspecialchars($tmpstr) . "]<hr>n";

 return  "n<!-- start $commentlabel //-->n$tmpstrn<!-- end $commentlabel //-->n";

}

 

I'll wait a couple days for people to find any more bugs and then I'll put up an updated contribution with the fixes added.

 

Now work it all perfectly, many, many, thanks. :D

Posted
after installing the Simple Template System the login button will

not work it was a clean install

 

It seems to be working for me. Did you make the fix listed above?

 

Here's a test install - can you duplicate the problem here:

http://www.jhtalk.org/22ms2clean/catalog/index.php

 

- bg

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Posted

Steps

I've a 2.2MS2 installation working

Copy files on includes

config.php add define('DIR_WS_TEMPLATE', DIR_WS_INCLUDES . 'template.html');

Use original template.html.

 

 

Go to Chart, adn work but don't work all.

 

On all productos, button for Add to chart don't work. I see code generate and it's wrong.

 

Examples:

 

http://hostin2.lomejordeinternet.net/compr...p?products_id=9

 

What it's wrong ?

Posted
Steps

I've a 2.2MS2 installation working

Copy files on includes

config.php add define('DIR_WS_TEMPLATE', DIR_WS_INCLUDES . 'template.html');

Use original template.html.

 

 

Go to Chart, adn work but don't work all.

 

On all productos, button for Add to chart don't work. I see code generate and it's wrong.

 

Examples:

 

http://hostin2.lomejordeinternet.net/compr...p?products_id=9

 

What it's wrong ?

 

New test.

If put $display_template_output = 0 and $display_normal_ourput =1 work fine (Without templates)

Isee code generate, and the problem it's that template not put tag form

 

<form name="cart_quantity" method="post" action="http://hostin2.lomejordeinternet.net/cesta/catalog/product_info.php?products_id=14&action=add_product">

Posted
New test.

If put $display_template_output = 0 and $display_normal_ourput =1 work fine (Without templates)

Isee code generate' date=' and the problem it's that template not put tag form

 

<form name="cart_quantity" method="post" action="http://hostin2.lomejordeinternet.net/cesta/catalog/product_info.php?products_id=14&action=add_product">

[/quote']

 

I just updated the contribution with a fix for the <form> tags issue. It sounds like the new version will fix your problem. Just download it and put in the new application_bottom.php file over the old one.

 

- bg

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Posted

Just put up a 1.2 version os STS that allows for URL-based turning on and off of the display options:

 

-----------------------------------------------------------------------------

REMOTE DEBUGGING:

-----------------------------------------------------------------------------

You can toggle the debugging options via URL options. You can use the

following parameters in your URL to turn on/off options from your browser

 

sts_template=1 Turns on the Template display

sts_template=0 Turns off the Template display

sts_normal=1 Turns on the Normal display

sts_normal=0 Turns off the Normal display

sts_debug=1 Turns on the Debugging display

sts_debug=0 Turns off the Debugging display

sts_version=1 Turns on Version Number display

sts_version=0 Turns off Version Number display

 

-----------------------------------------------------------------------------

 

This will make it easier to troubleshoot without having to keep going to the code to change things.

 

- bg

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Posted
Is it possible to insert head content into these templates for things like mouseovers and dynamic menus?

I haven't tried it, but it should be.

 

Just put it in the template.html 's head section.

 

If it doesn't work, let me know and I'll try to figure out a way to do it.

 

Also, get the latest version which is easier to debug.

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Posted

Hi,

 

is there or will there be a way to install your template system oever an existing shop what has different contribs allready installed ?

 

thanks for your nice contrib

 

regards

 

privacynet

Posted

After installing this (contrib ver 1.2) there are several lines before the doctype declaration:

<html>

<head>

<title>$title</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<base href="http://localhost/test.nl/catalog/">

<link rel="stylesheet" type="text/css" href="stylesheet.css">



<!-- start get_javascript(applicationtop2header) //-->

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html dir="LTR" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 

<title>osCommerce</title>

<base href="http://localhost/test.nl/catalog/">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<!-- end get_javascript(applicationtop2header) //-->

</head>

<body>

Am I doing something wrong or is it a little bug? (it does not happen in "normal mode")

 

Thanks for the contrib, it looks very good! Also the comments you added to the PHP code are great, even I can understand some of it now.

Posted

well im sure your use to dumb questions by now.. So one more shouldnt hurt.. Im new to this and attempting to learn by trail n error along with some reading, but ive downloaded the sts system and uploaded all the php files and the html file into includes.. this is the message I get ,

 

Warning: main(includes/filenames.php): failed to open stream: No such file or directory in /home/freedom/public_html/test/includes/application_top.php on line 53

 

Fatal error: main(): Failed opening required 'includes/filenames.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/freedom/public_html/test/includes/application_top.php on line 53

 

I have tinkered, edited and every thing that my limited knowledge can think to do.. now im looking for some meger education.. Thanks

Jerry

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...