Jump to content
DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

Hi Bill,

Well i've basically compared the load time with the same website with sts enabled and disabled. It's roughly a factor 2. On my laptop with local apache webserver the index page takes about 1sec to load with sts disabled and 2secs with sts enabled. I tried a bit with enabling/disabling parts of sts but it only makes a difference when i disable sts completely. I have a bare minimum regarding templates, only 1 default template and an infobox.php.html.

If you have some good trace points i'm willing to do some more performance measurements (or is it included in debug mode)?

Notice its not a big problem for me now but as a software engineer which i am i just want to make sure my applications perform best (as they should), or otherwise i want to know where and why i'm hitting a performance penalty.

Paul

Does your STS template page have any images that need to be optimized?

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites

Greetings. I have an issue I have worked my best to solve on my own however I seem to have run into a brick wall. I hope someone out there will be willing to help me. I will try and explain as best I can.

 

I would like to change the look of the center of the index page. The stock install of osCommerce, after STS is installed, goes something like this:

 

It starts with this text: This is the template for index.php page. You can find it here: catalog/includes/sts_templates/full/index.php.html

 

Next is the text: What’s New Here? and a picture to the far right. I know the text 'What’s New Here?' and the picture are both table elements. I know the table come from catalog/index.php and I *think* the code that controls it is here:

			<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

 

Ok, sorry to bore everyone to death with information they probably already know but now I can get to my question. I would like to remove, not change, the 'What’s New Here?' text and the picture. I have tried removing the code in catalog/index.php (assuming I have removed the correct code) with no results. If I remove this line:

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

Nothing happens. The text is still there as well as the table. To be more specific, I would like to remove, entirely, the table that contains the 'What's new here?' text and the picture to the right of it. If anyone can help me out, I would appreciate it. Thank you in advance.

Share this post


Link to post
Share on other sites

Hi

 

I finally figured out how to make the site fixed width 800 pixels and centered in the sts template. It works fine except when I click on a product catagory or the shopping cart. The table that contains the information in the center pushes the info box columns on left and right way out past 800 pixels.

 

Is there a way I can make these tables a fixed width?

 

Can I do this in a sts template?

 

Please help?


I have installed:

Oscommerce version 2.2rc2a, STS version 4.5.8, Header Tags SEO version 3.1.5, SEO Assistant version 2.1

 

Thanks

Joey

Share this post


Link to post
Share on other sites
Greetings. I have an issue I have worked my best to solve on my own however I seem to have run into a brick wall. I hope someone out there will be willing to help me. I will try and explain as best I can.

 

I would like to change the look of the center of the index page. The stock install of osCommerce, after STS is installed, goes something like this:

 

It starts with this text: This is the template for index.php page. You can find it here: catalog/includes/sts_templates/full/index.php.html

 

Simply remove the text from the template itself.

 

Next is the text: What’s New Here? and a picture to the far right. I know the text 'What’s New Here?' and the picture are both table elements. I know the table come from catalog/index.php and I *think* the code that controls it is here:

			<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

 

Ok, sorry to bore everyone to death with information they probably already know but now I can get to my question. I would like to remove, not change, the 'What’s New Here?' text and the picture. I have tried removing the code in catalog/index.php (assuming I have removed the correct code) with no results. If I remove this line:

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

Nothing happens. The text is still there as well as the table. To be more specific, I would like to remove, entirely, the table that contains the 'What's new here?' text and the picture to the right of it. If anyone can help me out, I would appreciate it. Thank you in advance.

 

Are you sure you want to do this? The HEADING_TITLE helps out quite a bit regarding Search Engine Optimization. It would be better to follow the option from the STS User Manual that would change this text into a dynamic heading that would display the category or product name, depending upon what page was being called.

 

If you still want to remove this, keep in mind that their is 3 occurances of HEADING_TITLE in the index.php file that you need to edit.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites
...

Thank you for the response. I am trying to go a different route now. It's probably still the wrong route but I'm getting somewhere now.

 

In sts_template.html I have removed the following:

	<td valign="top">
  <p>This is the default template<br>
 </p>
  <p>$content</p>
  <p> </p>
</td>

 

I am attempting to replace it with what I would like the center of the page to look like. I am still having one or two issues but that may be due to me not really knowing what I am doing.

 

I have some text in the center of the page however there is a large amount of white space between the bottom of the header and the start of the text. I have not figured out how to get rid of it yet. Here is what I have replaced the above code with:

	<td>
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr><td style="font-weight: bold" align="center">
	  <p>Hello and welcome to Tall Grass Farms!</p>
	</td></tr>
	<tr><td align="left">
	  <p>We are a small, family owned and operated farm specializing in Dahlias. We also raise Scottish Highlander Cattle.</p>
	</td></tr>
  </table>
</td>

 

I'm going to keep pressing on however any help with the above issue would be greatly appreciated. Thank you in advance.

Share this post


Link to post
Share on other sites
Thank you for the response. I am trying to go a different route now. It's probably still the wrong route but I'm getting somewhere now.

 

In sts_template.html I have removed the following:

	<td valign="top">
  <p>This is the default template<br>
 </p>
  <p>$content</p>
  <p> </p>
</td>

 

I am attempting to replace it with what I would like the center of the page to look like. I am still having one or two issues but that may be due to me not really knowing what I am doing.

 

I have some text in the center of the page however there is a large amount of white space between the bottom of the header and the start of the text. I have not figured out how to get rid of it yet. Here is what I have replaced the above code with:

	<td>
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr><td style="font-weight: bold" align="center">
	  <p>Hello and welcome to Tall Grass Farms!</p>
	</td></tr>
	<tr><td align="left">
	  <p>We are a small, family owned and operated farm specializing in Dahlias. We also raise Scottish Highlander Cattle.</p>
	</td></tr>
  </table>
</td>

 

I'm going to keep pressing on however any help with the above issue would be greatly appreciated. Thank you in advance.

Scott,

At some point you are going to need the $content tag or you will not pull any of the dynamic data in from osCommerce.

 

I would suggest saving your template as index.php_0.html (your home page template). Then, have the $content tag in the index.php.html template and the default template.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites
Scott,

At some point you are going to need the $content tag or you will not pull any of the dynamic data in from osCommerce.

 

I would suggest saving your template as index.php_0.html (your home page template). Then, have the $content tag in the index.php.html template and the default template.

Again, I thank you for your input. I will do as you suggest.

 

I am proud to say I am making *some* progress on my own. Below is my current code:

	<td valign="top">
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr><td align="center">
	  <p><b>Hello and welcome to Tall Grass Farms!</b></p>
	</td></tr>
	<tr><td align="left">
	  <p>We are a small, family owned and operated farm specializing in Dahlias. We also raise Scottish Highlander Cattle.</p>
	</td></tr>
  </table>
</td>

Thank you for your help.

 

Edit: I am using the 'test' template right now. Which file would be the default template in this directory?

Double edit: I always seem to type to soon. I switched to 'full' and have figured out what file was controlling the index. Again, thank you for your help.

Edited by Snarg

Share this post


Link to post
Share on other sites

using STS 4.5.8 $cat_ID tag within navigation. Also using AnyLink Drop Down Menu from Dynamic Drive, categories are formated as unordered lists from another contrib. With that says, all works well except after a few clicks.

 

Rolling over menu item A, the drop down appears for the categories – the status bar shows the cPath respectively as 1, 2, 3

 

menu item B is a single category cPath=4

 

and finally, menu item C with drop down sub categories with cPaths=5, 6, 7.

 

Clicking around on the menu works fine a few times, then if you view the page for cPath=6 and while on that page you click the navigation for cPath=4 - nothing happens.

 

While looking down at the status bar while hovering over menu item B the link now shows up as index.php?cPath=2_4_3_5_2&osCid...

 

needless to say that link doesn't work. All the while the $breadcrumbs is behaving oddly because now it will display, ie - Clothing>shoes>shirts>pants>jackets.

 

 

So, I hope that A.. this is understandable, and B.. not a repeated posting because I did search the forums but gave up because of the lack on findings.

Edited by oneshotenter

Share this post


Link to post
Share on other sites
using STS 4.5.8 $cat_ID tag within navigation. Also using AnyLink Drop Down Menu from Dynamic Drive, categories are formated as unordered lists from another contrib. With that says, all works well except after a few clicks.

 

Rolling over menu item A, the drop down appears for the categories – the status bar shows the cPath respectively as 1, 2, 3

 

menu item B is a single category cPath=4

 

and finally, menu item C with drop down sub categories with cPaths=5, 6, 7.

 

Clicking around on the menu works fine a few times, then if you view the page for cPath=6 and while on that page you click the navigation for cPath=4 - nothing happens.

 

While looking down at the status bar while hovering over menu item B the link now shows up as index.php?cPath=2_4_3_5_2&osCid...

 

needless to say that link doesn't work. All the while the $breadcrumbs is behaving oddly because now it will display, ie - Clothing>shoes>shirts>pants>jackets.

 

 

So, I hope that A.. this is understandable, and B.. not a repeated posting because I did search the forums but gave up because of the lack on findings.

Sounds like one of your other contributions are not working well with each other.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites
Sounds like one of your other contributions are not working well with each other.

 

 

Why can't we have a society of contributions that all play well together? ... I'll have to start debugging the store by disabling the ulcategories contribution first. Are there any suggestions of where to pinpoint a problem like this – so when I go looking in the stack of needles for a particular needle I might have a better shot? Thanks.

Share this post


Link to post
Share on other sites

Hi,

 

I have searched for the past 3 hours in these forums and also read the STS user guide, but I'm not quite sure that I understand the explanations correctly.

 

Basically I have STS 4.5.8 and the latest version of product extra fields. I can quite merrily add new fields. Examples are: - Height, Age, Owner, Award1, Award1 Year etc.

 

What I would like to do is create new variables for these so that I can format each individual field rather than rely on $content.

 

The nearest I can come to an example is: -

 

Sample of extra fields

 

I am sure this must be possible and feel I'm getting quite close, but after almost half a day searching I think I need help.

 

So, the million dollar question is "What files would I need to edit?"

 

Many thanks

Share this post


Link to post
Share on other sites
Does your STS template page have any images that need to be optimized?

 

Bill,

I've reloaded the index page a few times with sts on and off as shown in the image.

About the images, i'm not sure what 'optimzed' means so i've simply removed all the images (catalog/images) and under sts_templates.

Paul

 

procxp_sts.jpg

Share this post


Link to post
Share on other sites
Why can't we have a society of contributions that all play well together? ... I'll have to start debugging the store by disabling the ulcategories contribution first. Are there any suggestions of where to pinpoint a problem like this – so when I go looking in the stack of needles for a particular needle I might have a better shot? Thanks.

Some other things to look into:

 

  1. If you have Cache turned on in the admin, try turning it off to see if the issue is resolved.
  2. If you have 'Use Search Engine Friendly URLs" turned on in the admin, turn this off and be sure to never turn it on again.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites
Bill,

I've reloaded the index page a few times with sts on and off as shown in the image.

About the images, i'm not sure what 'optimzed' means so i've simply removed all the images (catalog/images) and under sts_templates.

Paul

 

What I meant be optimized images is that you may have some large image files that are not optimized for web use (good for print, bad for web) in your template pages that could be causing slow page uploads. Exchange these large image files with smaller image files and you will see a drastic reduction in your page loads.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites
Some other things to look into:

 

  1. If you have Cache turned on in the admin, try turning it off to see if the issue is resolved.
  2. If you have 'Use Search Engine Friendly URLs" turned on in the admin, turn this off and be sure to never turn it on again.

 

 

Those were the first places I checked as there was another posting that mentioned to try that with a similar issue. To my dismay those settings were already both set to Off. I'll have to check with the ul categories contribution as I believe that may be the culprit.

 

I'll post my findings.

Share this post


Link to post
Share on other sites
Hi,

 

I have searched for the past 3 hours in these forums and also read the STS user guide, but I'm not quite sure that I understand the explanations correctly.

 

Basically I have STS 4.5.8 and the latest version of product extra fields. I can quite merrily add new fields. Examples are: - Height, Age, Owner, Award1, Award1 Year etc.

 

What I would like to do is create new variables for these so that I can format each individual field rather than rely on $content.

 

The nearest I can come to an example is: -

 

Sample of extra fields

 

I am sure this must be possible and feel I'm getting quite close, but after almost half a day searching I think I need help.

 

So, the million dollar question is "What files would I need to edit?"

 

Many thanks

 

Steve,

You can do this in two different ways:

 

  1. Edit the product_info.php page itself to reflect the layout you want, or...
  2. Edit the sts_inc/product_info.php file by adding the new variables that you would need for the product extra fields. You will need to add the new database fields to the query and then follow the same code syntax used for the stock variables to create your new field variables. Then, create a content template and add these new variables into the desired layout.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites
Those were the first places I checked as there was another posting that mentioned to try that with a similar issue. To my dismay those settings were already both set to Off. I'll have to check with the ul categories contribution as I believe that may be the culprit.

 

I'll post my findings.

The Categories as a Nested Unordered List contribution works nicely with STS so I doubt that is the issue unless you installed/configured it incorrectly.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites

I have a site that uses a Flash header. It works okay as just a normal 'index.html' in the sts_templates/default/ folder, but when I rename the file to 'index.php.html' it shows me this error:

Parse error: syntax error, unexpected T_STRING in /home/scotts/public_html/catalog/includes/sts_templates/default/index.php.html on line 1

--when nothing was changed. Why won't it work as the STS .html files but will work when just a normal .html file not with STS?

 

Nevermind, got it to work. Just took out the "<?xml version="1.0" encoding="utf-8"?>" in the header

Edited by Kmberly

Share this post


Link to post
Share on other sites

Okay, new problem. I want to use "$cat_CategoryID" so I can put the links to the categories manually. I un-commented the code and tried all $cat_ and $caturl 's and all I see is the actual URL displaying on my page... no text of the category name, etc. Any ideas?

Share this post


Link to post
Share on other sites
Okay, new problem. I want to use "$cat_CategoryID" so I can put the links to the categories manually. I un-commented the code and tried all $cat_ and $caturl 's and all I see is the actual URL displaying on my page... no text of the category name, etc. Any ideas?

 

Kim,

If you are going to create manual links, it is best to do them as so:

 

STS Link to a category:

 

<a href="<?php echo tep_href_link('index.php', 'cPath=21&', 'NONSSL'); ?>">Category Name Here</a>

Where 21 would be the category ID.

STS Link to a product:

 

<a href="<?php echo tep_href_link('product_info.php', 'products_id=53&', 'NONSSL'); ?>">Product Name Here</a>

Where 53 would be the product ID.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites
Kim,

If you are going to create manual links, it is best to do them as so:

 

STS Link to a category:

 

<a href="<?php echo tep_href_link('index.php', 'cPath=21&', 'NONSSL'); ?>">Category Name Here</a>

Where 21 would be the category ID.

STS Link to a product:

 

<a href="<?php echo tep_href_link('product_info.php', 'products_id=53&', 'NONSSL'); ?>">Product Name Here</a>

Where 53 would be the product ID.

 

 

Just what I needed. Thanks!

Share this post


Link to post
Share on other sites

I am working with index.php.html to get my main page set up the way I would like it. In order to get what I am going for I removed the $content reference. In doing so I noticed that two things are now missing. I no longer have the line that says 'Welcome Guest! Would you like to log yourself in? Or would you prefer to create an account?' nor do I have the 'New Products' box. How would I go about bringing those items back? Since this is for my main index page only, I am doing this in a file called 'index.php_0.html. Below is the code I currently have for the center of the screen:

	<!-- Center column -->
<td valign="top" background="images/grey109.jpg">
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr><td align="center">
	  <div id="test1">
	  <p><b>Hello and welcome to Tall Grass Farms!</b></p></div>
	</td></tr>
	<tr><td>
	  <div id="test2">
	  <p>Tall Grass Farms is a family owned farm. We have ten acres located in Medical Lake, Washington,<br> just outside of Spokane. We currently raise Scottish Highland Cattle and grow over 500 varieties of Dahlias.<br> We will be offering our tubers to the public for the first time in the Spring of 2009,<br> but will also be taking orders in the fall of 2008. We will also be offering wonderful cut flowers this summer at the farm.</p></div>
	</td></tr>
  </table>
</td>

Thank you in advance for any help provided :)

Share this post


Link to post
Share on other sites
Steve,

You can do this in two different ways:

 

  1. Edit the product_info.php page itself to reflect the layout you want, or...
  2. Edit the sts_inc/product_info.php file by adding the new variables that you would need for the product extra fields. You will need to add the new database fields to the query and then follow the same code syntax used for the stock variables to create your new field variables. Then, create a content template and add these new variables into the desired layout.

 

Thanks for that Bill,

 

I had realised that the 2nd option was probably the best route for me. However, I may have asked the question incorrectly. I think what meant to ask is this - if I have the product extra fields and populate them them with information, how can I insert them individually into a template page. For example remove $content and replace with something like the following: -

 

Product id : $productid (this is a standard field)

Price : $price (this is a standard field)

Height : $height (this is from the extra fields)

Age : $age (this is from the extra fields)

Owner : $owner (this is from the extra fields)

Award1 : $award_1 (this is from the extra fields)

 

The objective is to be able to use CSS to arrange the output. Where do I create the new variables (from products extra fields) for STS and how do I get them into my STS product template? I presume that the variable is related to the products_extra_fields_id and products_extra_fields_value?

 

Oh dear, re-reading this still it doesn't seem to sound right and it's getting me quite frustrated as I realise the huge potential of STS and am using it sucessfully to format all of my other output!

 

Am I going mad (more mad!)?

 

Thanks

Share this post


Link to post
Share on other sites

Hi everyone,

 

All of my STS content is squished to the right side. I can't figure out for the life of me what it is. I tried maximizing the BOX_WIDTH but that does nothing.

 

For example:

http://i32.photobucket.com/albums/d1/kmberly/squished.gif

 

... and even my links to 'My Account' and 'Logoff' in the left column are squished (this only shows when you are logged in).

 

 

Help and any insight is appreciated.

Share this post


Link to post
Share on other sites
I am working with index.php.html to get my main page set up the way I would like it. In order to get what I am going for I removed the $content reference. In doing so I noticed that two things are now missing. I no longer have the line that says 'Welcome Guest! Would you like to log yourself in? Or would you prefer to create an account?' nor do I have the 'New Products' box. How would I go about bringing those items back? Since this is for my main index page only, I am doing this in a file called 'index.php_0.html. Below is the code I currently have for the center of the screen:

	<!-- Center column -->
<td valign="top" background="images/grey109.jpg">
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr><td align="center">
	  <div id="test1">
	  <p><b>Hello and welcome to Tall Grass Farms!</b></p></div>
	</td></tr>
	<tr><td>
	  <div id="test2">
	  <p>Tall Grass Farms is a family owned farm. We have ten acres located in Medical Lake, Washington,<br> just outside of Spokane. We currently raise Scottish Highland Cattle and grow over 500 varieties of Dahlias.<br> We will be offering our tubers to the public for the first time in the Spring of 2009,<br> but will also be taking orders in the fall of 2008. We will also be offering wonderful cut flowers this summer at the farm.</p></div>
	</td></tr>
  </table>
</td>

Thank you in advance for any help provided :)

 

The $content variable is what holds what is says – the main "content". Without this variable, you have no store. From the look of the code you want to add, and since you seem to want to retain the "welcome guest" and the new products box... in the includes/languages/english/index.php

 

look for define('TEXT_MAIN', 'Put your code here');

 

two things you can try, you can put your css/html code directly here within the ' ', or put it in its own html file and use an include feature to load that separate file.

 

thats how I'd do it, may not be the best option but it worked for me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×