Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Simple Template System (sts)


DiamondSea

Recommended Posts

How do I enable Header Tag that is included with STS 1.8 and which files do I need to copy and where do they need to be copied to?

 

Install the Header Tag Controller (HTC) according to it's own instructions for the admin area and the database changes, and copy the /catalog/includes/ files that come with HTC, but do not modify the files in the /catalog/ directory, because STS takes care of managing those changes for you.

 

That's about all there is to it.

 

- Brian

Edited by DiamondSea

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

Link to comment
Share on other sites

Simple Template System (STS) v1.9 Released

 

Version 1.9 of STS has been released and can be downloaded at the link in my signature.

 

Here's the changes for v1.9:

 

CHG: Corrections in README.txt file

ADD: $logoff and $urllogoff to sts_display_output.php. Thanks to Mike Castro Demaria!

ADD: $myaccountlogoff which shows "My Account | Logoff" if logged in or "My Account" if not logged in

ADD: OSC version checking and debugging display

ADD: Shameless plug for STS in HTML source

FIX: Turn off template display for "info_shopping_cart" in sts_display_output. Thanks to Peter Rettinger!

REF: http://www.oscommerce.com/forums/index.php?sho...ndpost&p=278722

FIX: For bug where clicking on Tell A Friend would add item to shopping cart. Thanks to Pater Rettinger!

REF: http://www.oscommerce.com/forums/index.php?sho...ndpost&p=278831

UPG: To upgrade from v1.8, simply replace the sts_display_output.php file.

 

If you encounter any problems with the new release please let me know!

 

Also, be sure to check out the new STS Support Site here:

http://www.diamondsea.com/sts/

 

There is also a new mailing list where you can subscribe to get email notices of new releases and other news about STS. It's a great tool for people who don't live on these forums!

 

Enjoy!

 

- 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

Link to comment
Share on other sites

I am very excited about what it looks like STS can do, but I am having some problems getting started with it.

 

This is the first time that I have tried using os-commernce as well, so that is probably not helping. I have everything set up, and it appears to be working, except that some changes I make to the template are not being reflected on the site.

 

For example, I can alter the boxes that appear on the page, and where they appear through the keywords system no problem, but when I try to make the make the background of the page black, and change the default text color, I get no results.

 

Is this what is supposed to happen? If so, how do I make these sorts of change? do I have to dig through all of the .php files?

 

Guess I will go digging around for a style sheet or something...

 

Thanks!

Link to comment
Share on other sites

Is there any information about an upgrade from 1.8 to 1.9?

 

UPG: To upgrade from v1.8, simply replace the sts_display_output.php file.

 

Hope this helps!!!

Edited by BlessIsaacola

Contributions:

STS

Header Tags

Ebay Auctions

Ebay Auction Sales Manager

Html Wysiwyg Editor

Ultrapics

Paypal Cart IPN

Info Pages Unlimited

Shop By Price

Link to comment
Share on other sites

ahhhh crapppp

 

whats the upgrade hint for upgrading from 1.6 to this new one? I just tried to replace the output file and it threw up on m e :(

 

anyone/ Help?

Link to comment
Share on other sites

Template file doesn't exist: [includes/sts_template.html]
Warning: fopen(STS_DEFAULT_TEMPLATE): failed to open stream: No such file or directory in /home/stage/public_html/catalog/includes/sts_display_output.php on line 92
Can't open Template file: [STS_DEFAULT_TEMPLATE]
Warning: filesize(): Stat failed for STS_DEFAULT_TEMPLATE (errno=2 - No such file or directory) in /home/stage/public_html/catalog/includes/sts_display_output.php on line 96

Warning: fread(): supplied argument is not a valid stream resource in /home/stage/public_html/catalog/includes/sts_display_output.php on line 96

Warning: fclose(): supplied argument is not a valid stream resource in /home/stage/public

 

That's what i get...

Link to comment
Share on other sites

UPG: To upgrade from v1.8, simply replace the sts_display_output.php file.

 

Hope this helps!!!

Yes, thank you, and sorry about the stupid question. :unsure: didn't check out the changelog, just the readme... (rtfm)

Link to comment
Share on other sites

Template file doesn't exist: [includes/sts_template.html]
Warning: fopen(STS_DEFAULT_TEMPLATE): failed to open stream: No such file or directory in /home/stage/public_html/catalog/includes/sts_display_output.php on line 92
Can't open Template file: [STS_DEFAULT_TEMPLATE]
Warning: filesize(): Stat failed for STS_DEFAULT_TEMPLATE (errno=2 - No such file or directory) in /home/stage/public_html/catalog/includes/sts_display_output.php on line 96

Warning: fread(): supplied argument is not a valid stream resource in /home/stage/public_html/catalog/includes/sts_display_output.php on line 96

Warning: fclose(): supplied argument is not a valid stream resource in /home/stage/public

 

That's what i get...

The template file structure changed recently to support multiple template files, which is why you need to do a little more for older versions than 1.8..

 

Just:

 

- Copy the files from the ZIP file into place

 

- Update the various STS defines (there's a few new ones) in /catalog/includes/configure.php from the configure-SAMPLE.php file.

 

and it should work for you.

 

FYI, when you see a defined variable name appear in an error message like this:

 

Warning: fopen(STS_DEFAULT_TEMPLATE): failed to open stream: No such file or directory in

 

it means that you don't have the define statement in your configure.php file.

 

- 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

Link to comment
Share on other sites

I've got a little font size problem and I'm not sure how to fix it. Basically the fonts in all my message boxes are too big, now in the stylesheet virtually all the fonts are 10px, certainly all the message box ones, the body ones, i think it's just user greating and an error message not at 10 px. in my sts_default_template the boxes say they are font size 1.

 

where else could the font size for all the text boxes be controlled, and why aren't they obeying whats in my stylesheet and template?

Link to comment
Share on other sites

The template file structure changed recently to support multiple template files, which is why you need to do a little more for older versions than 1.8..

 

Just:

 

- Copy the files from the ZIP file into place

 

- Update the various STS defines (there's a few new ones) in /catalog/includes/configure.php from the configure-SAMPLE.php file.

 

and it should work for you.

Thanks Brian! I swear I'm a complete ditz sometimes!! It was as easy as that..just added the new code to configure.php and everything is working!! Runs awesome too :) The tell a friend box now works like a charm ;)

 

Thanks for all of your help!!! And again, the BEAUTIFUL contribution!!

Link to comment
Share on other sites

where else could the font size for all the text boxes be controlled, and why aren't they obeying whats in my stylesheet and template?

Hi there, check to see if you have the full url of the stylesheet into the sts_template. I once had it in there, but only had it at /stylesheet.css you have to put the full link in there http://yoursite.com/catalog/stylesheet.css or however yours is...

Link to comment
Share on other sites

OK so the stylesheet call in my sts_default_template is

 

<head>

<!--$headcontent-->

<link rel="stylesheet" type="text/css" href="http://elitevibes.com/toys/stylesheet.css">

</head>

 

 

it is the full link now but i still seem to have overly large fonts. as far as i know it's not in any other file and i only have one template (one is enough for me to mess up at the moment)

 

Is this the right stylesheet call, is it in the right place and should it be in any other file as well?

 

Sorry for being a pain everyone this is one of those silly little niggles, my site isn't broken completely though so i guess my tweaking and changing isn't as bad as it used to be.

Link to comment
Share on other sites

I'm getting this error on a fresh OSC working Install:-

 

Template file doesn't exist: [includes/sts_template.html] Warning: fopen("STS_DEFAULT_TEMPLATE", "r") - No such file or directory in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 92 Can't open Template file: [sTS_DEFAULT_TEMPLATE] Warning: stat failed for STS_DEFAULT_TEMPLATE (errno=2 - No such file or directory) in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 96 Warning: Supplied argument is not a valid File-Handle resource in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 96 Warning: Supplied argument is not a valid File-Handle resource in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 97 Fatal error: Failed opening required 'STS_USER_CODE' (include_path='.:/usr/share/pear') in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 104

 

I added the code into configure.php as required but it doesn't work. Any help appreciated.

Link to comment
Share on other sites

I'm getting this error on a fresh OSC working Install:-

 

Template file doesn't exist: [includes/sts_template.html] Warning: fopen("STS_DEFAULT_TEMPLATE", "r") - No such file or directory in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 92 Can't open Template file: [sTS_DEFAULT_TEMPLATE] Warning: stat failed for STS_DEFAULT_TEMPLATE (errno=2 - No such file or directory) in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 96 Warning: Supplied argument is not a valid File-Handle resource in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 96 Warning: Supplied argument is not a valid File-Handle resource in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 97 Fatal error: Failed opening required 'STS_USER_CODE' (include_path='.:/usr/share/pear') in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 104

 

I added the code into configure.php as required but it doesn't work. Any help appreciated.

You don't have the defines correct in /catalog/includes/configure.php. Look at the configure-SAMPLE.php that came with STS. You don't have (at least) the STS_DEFAULT_TEMPLATE defined.

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

Link to comment
Share on other sites

This is from the thread STS - how do I make templates for each category? - I'm posting my response here for the benefit of the main support thread. Thanks Brian for the great contrib - this is what I had in mind for a templating system.

 

I've been studying the code for the stock MS2 and STS 1.9 and just happened to be looking at the portions in question.

 

One quick and simple possibility would be to set $sts_template_file to the appropriate template file based on $current_category_id using a CASE block, if statements, etc. This check could ideally be integrated into the script check at line 80 in sts_display_output.php, or placed just below it.

 

Example (code block begins at line 78 in sts_display_output.php):

// See if there is a template file for the currently running script
$sts_template_file = STS_TEMPLATE_DIR . $scriptbasename . ".html";
if (file_exists($sts_template_file)) {
 // Use it
} else {
 // This assumes the category template is named after the category id
 $sts_template_file = STS_TEMPLATE_DIR . $current_category_id . ".html";
 if (file_exists($sts_template_file)) {
   // Use the category template
 } else {
   // Otherwise, use the default template
   $sts_template_file = STS_DEFAULT_TEMPLATE;
 }
}

 

In that example the category template name is based on the category id. So using the default data, the template for Hardware (ID=1) would be named 1.html. You can reference the categories_description table for the category descriptions and names.

 

Keep in mind that this is just a "quick and dirty" solution that can be extended from this point.

 

Cheers,

 

-C

Link to comment
Share on other sites

Great idea with the templates-by-categories - I'll try to add something like this to the next version of STS.

 

As to adding Page Titles, I'd recommend using Linda's Header Tag Controller. It lets you customize the Title, Meta-tag fields on a per-item basis that makes it look better. ANd STS already has built in support for it so that you don't have to modify every file in your /catalog/ directory.

 

Also, you might want to keep future posts over on the main thread if you want me to see it (thanks Chris, for the cross-post).

 

- 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

Link to comment
Share on other sites

Hi Brian, firstly great job on the template system! I had little problems installing it with my fresh install of OSC. However, I'm completely new to osc and php and would really appreciate a little help and nudge in the correct direction from everyone here.

 

After installing, I realised that the main part I still need to change is the stuff within $content. As Brian mentioned in a previous post, the php files themselves would still have to be modified. This is where I need some help. How and whereabouts to I start modifying it? I believe the stuff to be modified is in the index.php file? Or is there other stuff?

 

I saw some of the great sites on STS sample sites and I was wondering how you go about adding a text msg instead of having the products all show on the first page, and how to how the products in different layout.

 

Any help would be GREATLY appreciated!! :D

Link to comment
Share on other sites

Template file doesn't exist: [includes/sts_template.html] Warning: fopen("STS_DEFAULT_TEMPLATE", "r") - No such file or directory in /home/stgiles/public_html/catalog/includes/sts_display_output.php on line 92 Can't open Template file: [sTS_DEFAULT_TEMPLATE] Warning: stat failed for STS_DEFAULT_TEMPLATE (errno=2 - No such file or directory)

i had the same problem too. you see one of the files you uploaded was the sts_template but you don't have a sts_default_template. so check in the configure that the sts_default_template is defined, and then upload another version of the sts_template but call it sts_default_template. this is then the one you want to change.

Link to comment
Share on other sites

Thanks Chris! Your suggestion works perfectly.

 

By the way, I was trying to figure out how to change the HEADER_TITLE on every category page so they are unique depending on the category. I'd also like to completely remove the HEADER_TITLE from the homepage. I tried just leaving the parameters for the line below in index.php blank, as follows:

 

define('HEADING_TITLE', '');

 

but that still leaves an awful space on my homepage where the title should be.

 

Any tips?

 

The Header Tag Controller is a great mod from what I've seen - I haven't integrated it yet - but it won't do anything on the HEADER_TITLE to make each category header (which isn't part of the actual HTML header) unique.

 

There are several ways to do this. If have very few categories, a quick and really dirty solution could be to use conditional statements to set the define in the language's index.php. Obviously this hack would be impractical for more than a handful of categories, and it's ugly to boot.

 

A better way to go about it would be to set HEADER_TITLE to another value, such as the category name, which is in the categories_description table. Here's how:

 

Replace the references to HEADER_TITLE to $header_title in the 'nested' and 'products' IF blocks (the first two HEADER_TITLE occurrences of three total) in /catalog/index.php. It should look like

            <td class="pageHeading"><?php echo $heading_title; // echo HEADING_TITLE; ?></td>

and

            <td class="pageHeading"><?php echo $heading_title; // echo HEADING_TITLE; ?></td>

(I left the HEADING_TITLE tag commented out so I'd remember the edit.)

 

Next, under the following code:

 

  if ($category_depth == 'nested') {
   $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");
   $category = tep_db_fetch_array($category_query);

 

Add the lines:

 

    // added to display category-specific headings instead of HEADING_TITLE
   // references to HEADING_TITLE changed to $heading_title except in default page display
   $heading_title = $category['categories_name'];

 

That takes care of the header name for the nested category display. For the category products display add the lines:

 

// added to look up category name and use as table header instead of HEADING_TITLE
   if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
       $category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and language_id = '" . (int)$languages_id . "'");
} else {
       $category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'");
}
   $category = tep_db_fetch_array($category_query);
   $heading_title = $category['categories_name'];

 

This should be added just ABOVE the section that begins with

// show the products of a specified manufacturer

 

You should now be seeing the current category name as the header for the page table instead of the "Let's See what We Have Here" and whatnot. I opted to leave the HEADER_TITLE in for the default index view since that needs no customization beyond editing the original default define in the language index.php.

 

This can be easily extended by adding an additional field to the categories_description table, such as header_title. You would then just change the query in $category_query to lookup new field name. If I went this far I'd modify the admin section to include the new field so I could edit the value easily.

 

Cheers,

 

-C

Link to comment
Share on other sites

Does the newest version of STS support the newest version of Linda McGrath's Header Tag Controller?

 

I just installed a clean OSC MS2 and STS 1.9. Before I screw anything up I want to know if the installation instructions in STS readme file work with this version:

 

12/30/2003 - Header Tags Controller v2.2 Complete

Author: Oswaldo Herrera

 

or should I just use the original version (Linda McGrath's v1.0).

 

 

Thanks Brian for such a wonderful contribution. Really makes things simple.

 

 

 

 

P.S. excuse the double post....meant to reply to topic. :unsure:

Contributions in use

 

www.oscommerce.com/community/contri...ons,1506/page,2

www.oscommerce.com/community/contributions,1480

www.oscommerce.com/community/contributions,1712

Link to comment
Share on other sites

(crossposted from http://www.oscommerce.com/forums/index.php?showtopic=77299 - but I see Alysehia beat me to it ;) )

 

Does the newest version of STS support the newest version of Linda McGrath's Header Tag Controller?

 

I just installed a clean OSC MS2 and STS 1.9. Before I screw anything up I want to know if the installation instructions in STS readme file work with this version:

 

12/30/2003 - Header Tags Controller v2.2 Complete

Author: Oswaldo Herrera

 

or should I just use the original version (Linda McGrath's v1.0).

 

 

Thanks Brian for such a wonderful contribution. Really makes things simple. 

 

They do play well together. STS 1.9 has support for the Header Tag mod built into sts_display_output.php, so when you install the newest version of HTC make sure you don't add the code that's supposed to go into application_top.php. So far everything seems fine on my system.

 

-C.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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