Jump to content
DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

I have not forgotten about you...just that I am not sure what the "best" answer would be in your situation.

For most STS users who have multi-language shops, the images in the template is the only real hurdle to cross since they are already taking advantage of the "built-in" multi-language functions of osCommerce itself.

Ah, thank you :)

Maybe the solution would be to not change the language until the user click on the flag... I mean to make osc or the navigator remember wich language has been selected, but I have no idea on how to do that...

Share this post


Link to post
Share on other sites

The Simple Template System certainly seems like it would be a very useful addition to my catalog but there's already another contribution (Header Tags Controller v2.6.3) incorporated into it and I was wondering if this would cause problems with the operation of either contribution or the installation of the STS.

 

Some background information might be helpful:

  • The Header Tags Controller was installed into a brand new catalog
  • The only changes made since that installation was setting the permissions in catalog/includes/configure.php to 444 (to rid my home page of an error that stated: Warning: I am able to write to the configuration file: ***/htdocs/catalog/includes/configure.php. This is a potential security risk - please set the right user permissions on this file.) and removing the instructional text on the home page that comes with every new catalog

My original intention was to just post a question, somewhere in these forums, asking how to insert a new info box into the left panel of each page. However, upon investigation it seems like the STS is the correct tool for this task. Is it?

Share this post


Link to post
Share on other sites

If you only want to add an infobox in a column, you can add it in column_left.php or column_right.php, without installing STS. STS do much more than easily adding/removing boxes, so it depends what you really want to do.

 

- Chris


STS v4.5 SP5 is out, and check the STS Power Pack contribution too!

New thumbnailer using phpThumb: oscThumb. Works great.

Share this post


Link to post
Share on other sites

Hey, im pretty much a huge newbie at this and am attempting to all this from scratch with a very subtle HTML background. As i browse through the PHP files im curious to where you define what the "placeholders" hold, if the makes sense. Basically i type $content in my html file and it displays whatever $content is holding. I was hoping to adjust what these placeholders were displaying if i could. Thanks.

 

-Dinny

Share this post


Link to post
Share on other sites

It depends on what you want to change. A lot of changes can be made through the language files. The main content of the index page can be changed in the language files. You can access them through the admin panel under Tools. There is a variable called MAIN that holds the content for the main part of this page. The same can be done for most of the language on your other pages.

 

If you want to make changes other than language, you would need to modify the PHP file for that particular template.

 

Hey, im pretty much a huge newbie at this and am attempting to all this from scratch with a very subtle HTML background. As i browse through the PHP files im curious to where you define what the "placeholders" hold, if the makes sense. Basically i type $content in my html file and it displays whatever $content is holding. I was hoping to adjust what these placeholders were displaying if i could. Thanks.

 

-Dinny

Share this post


Link to post
Share on other sites
If you only want to add an infobox in a column, you can add it in column_left.php or column_right.php, without installing STS. STS do much more than easily adding/removing boxes, so it depends what you really want to do.

 

- Chris

Thanks, Chris! :thumbsup:

 

For the time being I guess I'll just go ahead and modify my column_left.php and leave the STS to some other time.

 

 

- Wayne

Share this post


Link to post
Share on other sites

yes, i understand that, but lets say i wanted to split $content up to a $header and a $body..... where is $content <-- defined as the place holder. Sorry for not explaining that well, as i reread you answered my question , but that wasn't what i wanted to ask.. Thanks

 

 

-Dinny

Share this post


Link to post
Share on other sites

What is captured in the content variable varies dependent on what page you want to change. It includes everything you would see in the main part of the default page (not the header, left or right columns, or footer). If you want to manipulate what is in the content variable, you would need to know some PHP as you need to change the actual file for each page, i.e. to change the index or category pages you would make changes to index.php, to make changes to the product info pages you need to change product_info.php, etc. The file sts_display_output is where many placeholder variables are defined.

 

 

 

yes, i understand that, but lets say i wanted to split $content up to a $header and a $body..... where is $content <-- defined as the place holder. Sorry for not explaining that well, as i reread you answered my question , but that wasn't what i wanted to ask.. Thanks

-Dinny

Share this post


Link to post
Share on other sites

$content is produced by sts. it is a cut and chop of any of the osc catalog folder files, be that index.php conditions.php or loginin.php etc

 

sts will capture the code from say index.php and then chop out all the stuff not needed from the front and back of the file depending upon the start and stop points. ie everything before '<table' and everything after </table> "within the body text comment tags.

 

you can create your own content by doing something similar as this or boxes. sts removes the <Tr><td> and </td></tr> from the osc boxes but keeps the rest of the code within.

 

sts makes things simple by droping $variables into a template. the $content is one, and there are others for all the boxes etc

 

to change what comes out via $content you need to gointo say inde.php, separate it out with space so you can see what it does then add in your code. it takes a little work!

 

have a look at my home and index pages of my site (see signature) these are built from chopped code from serveral parts of the osc index.php to build catagory lists with products. notice that these are not stock osc pages, they are found under the shop directory.

 

matt

 

 

What is captured in the content variable varies dependent on what page you want to change. It includes everything you would see in the main part of the default page (not the header, left or right columns, or footer). If you want to manipulate what is in the content variable, you would need to know some PHP as you need to change the actual file for each page, i.e. to change the index or category pages you would make changes to index.php, to make changes to the product info pages you need to change product_info.php, etc. The file sts_display_output is where many placeholder variables are defined.

Share this post


Link to post
Share on other sites

hi everyone!

I'm having a encoding problem, my native language shows the special chars as ? in firefox or rectangles in IE, I can't find where to change this, as the languages are all set correctly in the language.php =/

I'm posting it here because i've heard that STS might cause this sometimes...

 

the english language is correct, but when i turn it to portuguese the Í or à don't appear...take a look please, www.corfer.com

 

thanks

Share this post


Link to post
Share on other sites
hi everyone!

I'm having a encoding problem, my native language shows the special chars as ? in firefox or rectangles in IE, I can't find where to change this, as the languages are all set correctly in the language.php =/

I'm posting it here because i've heard that STS might cause this sometimes...

 

the english language is correct, but when i turn it to portuguese the Í or à don't appear...take a look please, www.corfer.com

 

thanks

For the STS template, you designate the encoding in the first line of the template:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Other than that, STS does not control the encoding of the stock osC pages. This is done in the following file:

 

catalog/includes/languages/*your_language*.php file in the following lines:

 

// Global entries for the <html> tag
define('HTML_PARAMS','dir="LTR" lang="en"');

// charset for web pages and emails
define('CHARSET', 'iso-8859-1');


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

thanks but it did not work...i don't understand why it keeps popping to utf8, i've tried finding where it's defined but no luck so far....i guess the language.php should be enough to set the correct charset....

Share this post


Link to post
Share on other sites
thanks but it did not work...i don't understand why it keeps popping to utf8, i've tried finding where it's defined but no luck so far....i guess the language.php should be enough to set the correct charset....

Have you tried setting your browser to the correct encoding that is needed? The following link may be of some assistance if you do not know how to do this:

http://tlt.its.psu.edu/suggestions/interna...sers/iewin.html

 

Hope this helped,


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

yes, i tried that , and I even used 3 different browsers, Opera, IE, Firefox, I added the <meta> tag that was missing from my template and it fixed it on firefox, but i'm still having problems in the opera and IE =/

Share this post


Link to post
Share on other sites

Hello to all.

 

I have a problem with in some of my pages.

 

advanced_search.php, about_us.php, featured_products.php, contact_us.php, login.php, shopping_cart.php, checkout_shipping.php and reviews.php.

 

On all these pages there are a blank space, between heder and the begin of the main.

 

See on the link: reviews.php

 

 

Tx in advance for help.

 

Rafael


OScommerce Rocks!

Share this post


Link to post
Share on other sites
Hello to all.

 

I have a problem with in some of my pages.

 

advanced_search.php, about_us.php, featured_products.php, contact_us.php, login.php, shopping_cart.php, checkout_shipping.php and reviews.php.

 

On all these pages there are a blank space, between heder and the begin of the main.

 

See on the link: reviews.php

Tx in advance for help.

 

Rafael

 

 

I noted that these pages arent linked with STS contribution. I only create the about_us.php.html on full directory and the other about_us.php.html file on content directory.

 

If anyone has the light...

 

Tx


OScommerce Rocks!

Share this post


Link to post
Share on other sites
I noted that these pages arent linked with STS contribution. I only create the about_us.php.html on full directory and the other about_us.php.html file on content directory.

 

If anyone has the light...

 

Tx

This is caused by incorrect table properties <table> and <td> as well as <p>. Look in either your template or the actual PHP file to remove the extra tables and paragraph returns.

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
This is caused by incorrect table properties <table> and <td> as well as <p>. Look in either your template or the actual PHP file to remove the extra tables and paragraph returns.

 

 

Hi bk...

 

I think no, because on right side, the infobox, new products(are listing 6 products), when i remove, ex: 5 products, the head of main about_us.php goes up... but dont too the limit with the header... the main just up the half of the blank space. The other half still blank, eihter i removed the 5 products and lefting 1 product on new products infobox.

 

And i use the file english.php to put the pictures, on right site too (low shpping + bookmark + support on line-crafty).

 

 

I think that the problem is on the infobox, new products.

 

 

Tx


OScommerce Rocks!

Share this post


Link to post
Share on other sites

Dear All,

 

I am new to here and I love STS very much, thanks the author.

 

I have another way of having a different image for different language and I think it is more systematic than the suggested solution given by author before.

 

 

1.

Add this line in includes/modules/sts_inc/general.inc:

$sts->template['lang'] = DIR_WS_LANGUAGES . $language;

 

2.

Open the template files created in includes/sts_templates/[your_template]/ ,

Edit the image sources with the following format:

$lang/images/menu.swf

where "menu.swf" can be replaced by any filename you like.

 

3.

Open your language folder at includes/languages/[your language code]/images

 

4.

Put in your image with the filename specified in step 2. [e.g. register.jpg]

http://www.hkrobot.com

5.

Do step 3-4 again to put all your images with different languages into the language folders.

 

For example, I got a Traditional Chinese version [language of Hong Kong] flash menu and a English version flash menu

I put the two different flash files into:

includes/languages/hk/menu.swf [Chinese content] and

includes/languages/english/menu.swf [English Content]

 

Through this way, all the files can be saved with the SAME NAME in DIFFERENT language FOLDERS, instead of changing the name of the files into strange abc1.jpg abc2.jpg.

The previous suggested solution takes the language CODE as the "dynamic" parameter, this may lead to confusion when webmasters changes the language codes in the admin backend.

For example someone changes hk language code from 2 to 1 and english language code from 1 to 2, then the images of the whole site will be messed up... By using "DIR_WS_LANGUAGES . $language" as the dynamic parameter, no matter what does the admin do with the language priority, the images will be correct.

 

For a demo, have a look at http://www.hkrobot.com/index.php

This is a test site, the chinese version is not ready but by viewing the html source code, you can see the menu.swf comes from two different folders when you choose to change language.

Remember to add index.php behind the domain name as I used a index.htm to cover the site, if you go http://www.hkrobot.com , you get a fake page that redirects you away.

Share this post


Link to post
Share on other sites
Hi bk...

 

I think no, because on right side, the infobox, new products(are listing 6 products), when i remove, ex: 5 products, the head of main about_us.php goes up... but dont too the limit with the header... the main just up the half of the blank space. The other half still blank, eihter i removed the 5 products and lefting 1 product on new products infobox.

 

And i use the file english.php to put the pictures, on right site too (low shpping + bookmark + support on line-crafty).

 

 

I think that the problem is on the infobox, new products.

 

 

Tx

I was able to isolate the errant table(s) by using the "Developers Toolbar" for IE. It showed the problem as a table that was being output in the final source code (after being rendered by the PHP of course) so I could not isolate if the errant table was from your template or being pulled in by PHP code through your PHP scripts such as about_us.php or reviews.php, etc.

It is definitely a tables issue and not a CSS issue. I was able to remove the specials.gif image and the table that it was in as well as set the content table to align "top" to correct the problem.

 

You will have to find out where the table and image is located and remove it as well as align the content table to "top".

 

:thumbsup: A quick way to help isolate the errant table would be to compare your PHP scripts with the original stock osC version of the same file since this does not occur in a stock version. You would be able to determine if the cause is in your template or in the actual HTML within the PHP script.

 

Hope this helped you out,

Edited by bkellum

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 was able to isolate the errant table(s) by using the "Developers Toolbar" for IE. It showed the problem as a table that was being output in the final source code (after being rendered by the PHP of course) so I could not isolate if the errant table was from your template or being pulled in by PHP code through your PHP scripts such as about_us.php or reviews.php, etc.

It is definitely a tables issue and not a CSS issue. I was able to remove the specials.gif image and the table that it was in as well as set the content table to align "top" to correct the problem.

 

You will have to find out where the table and image is located and remove it as well as align the content table to "top".

 

:thumbsup: A quick way to help isolate the errant table would be to compare your PHP scripts with the original stock osC version of the same file since this does not occur in a stock version. You would be able to determine if the cause is in your template or in the actual HTML within the PHP script.

 

Hope this helped you out,

 

 

thank you bk

 

I will try do something and post the results...


OScommerce Rocks!

Share this post


Link to post
Share on other sites
thank you bk

 

I will try do something and post the results...

 

 

I found the solution for my problem.

 

As bkellum said, the problem was on my table main of each page.

 

In case of, for example, about_us.php page.. it was simple... i just added <p> </p> <p> </p> <p> </p> on final of my about_us.php page, located on english folder.

 

But on case on advanced_search, for example, that have some boxes to fill, i must edit the advanced_search.php on root folder.

 

Tx one more bkellum...

 

Rafael


OScommerce Rocks!

Share this post


Link to post
Share on other sites

hello

 

i installed the sts on the site but it gives this error

 

 

 

 

Template file doesn't exist: [DIR_WS_TEMPLATE]

Warning: fopen() [function.fopen]: Unable to access DIR_WS_TEMPLATE in /storage/mijndomein/users/029743/public/sites/www.paintballparadise.nl/clone/includes/application_bottom.php on line 75

 

Warning: fopen(DIR_WS_TEMPLATE) [function.fopen]: failed to open stream: No such file or directory in /storage/mijndomein/users/029743/public/sites/www.paintballparadise.nl/clone/includes/application_bottom.php on line 75

Can't open Template file: [DIR_WS_TEMPLATE]

Warning: filesize() [function.filesize]: Stat failed for DIR_WS_TEMPLATE (errno=2 - No such file or directory) in /storage/mijndomein/users/029743/public/sites/www.paintballparadise.nl/clone/includes/application_bottom.php on line 79

 

Warning: fread(): supplied argument is not a valid stream resource in /storage/mijndomein/users/029743/public/sites/www.paintballparadise.nl/clone/includes/application_bottom.php on line 79

 

Warning: fclose(): supplied argument is not a valid stream resource in /storage/mijndomein/users/029743/public/sites/www.paintballparadise.nl/clone/includes/application_bottom.php on line 80

 

thnx for the help

Share this post


Link to post
Share on other sites

Hi all,

 

I'm setting up a new store and used the latest release: osCommerce Online Merchant v2.2 Release Candidate 1.

I set up the latest sts: STS v4.5.3 for osC Online Merchant RC1 but noticed there were no header tags. I have an older store with sts that came with the header tags included. Anyway, I set up Header Tags Controller V2.6.3 Complete, but can't get it working with the templates. If I turn the templates off in admin the headers show up fine. Is there something I need to do to the sts scripts, and if so what?

 

Thanks.

Share this post


Link to post
Share on other sites
Hi all,

 

I'm setting up a new store and used the latest release: osCommerce Online Merchant v2.2 Release Candidate 1.

I set up the latest sts: STS v4.5.3 for osC Online Merchant RC1 but noticed there were no header tags. I have an older store with sts that came with the header tags included. Anyway, I set up Header Tags Controller V2.6.3 Complete, but can't get it working with the templates. If I turn the templates off in admin the headers show up fine. Is there something I need to do to the sts scripts, and if so what?

 

Thanks.

 

I decided to start over with STS and HTC Bundle. I just did a clean install, no other contribs. Front end works but I can't get the admin to come up. I get a 404 page not found error, even though all the files are there.

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

×