Jump to content
DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

Nice to have you back Brian, I probably wound not be here if it wasn't for the STS !!!

 

Jimmy

 

www.DVBHardware.com


I'm not a coder just a splicer.

Share this post


Link to post
Share on other sites
Nice to have you back Brian, I probably wound not be here if it wasn't for the STS !!!

 

Jimmy

 

www.DVBHardware.com

 

Thanks! Glad it's helpful!

 

If I could just get someone to pay all my bills for me I'd be able to spend a lot more time here! :huh:

 

- 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://forums.oscommerce.com/index.php?showtopic=58541

Share this post


Link to post
Share on other sites

Just Installed STS3 Beta. Works like a dream and I love the ability to include PHP code inside the template. Fantastic contribution enhancement! :thumbsup:

Share this post


Link to post
Share on other sites

Hi,

 

just installed the 3.0 beta and have some error messages:

 

Template file doesn't exist: []Can't open Template file: []

Warning: fread(): supplied argument is not a valid stream resource in C:\apachefriends\xampp\htdocs\stech\catalog\includes\sts_display_output.php on line 163

 

Warning: fclose(): supplied argument is not a valid stream resource in C:\apachefriends\xampp\htdocs\stech\catalog\includes\sts_display_output.php on line 164

 

Fatal error: main() [function.require]: Failed opening required '' (include_path='.;c:\apachefriends\xampp\php\pear\') in C:\apachefriends\xampp\htdocs\stech\catalog\includes\sts_display_output.php on line 183

 

 

Since I am not a php expert I am not sure what is wrong.

I left the sts_templates folder with the osc folder as it is. That means I copied it into the includes folder as with the old version.

 

What have I done wrong? do I need to move the template with all files in it into the includes folder?

 

Regards

 

Pathfinder

Edited by Pathfinder

Share this post


Link to post
Share on other sites

There should be new template files in /includes/sts_templates/osc/* if you unzipped it correctly. Also, make sure you have all the DEFINEs from the new configure-SAMPLE.php in your configure.php file.

 

Add &sts_debug=1 to your URL in your browser when viewing a page and it will display the template files it is looking for and if it found any of them. That should help track down the error.

 

- Brian

 

Hi,

 

just installed the 3.0 beta and have some error messages:

 

Template file doesn't exist: []Can't open Template file: []

Warning: fread(): supplied argument is not a valid stream resource in C:\apachefriends\xampp\htdocs\stech\catalog\includes\sts_display_output.php on line 163

 

Warning: fclose(): supplied argument is not a valid stream resource in C:\apachefriends\xampp\htdocs\stech\catalog\includes\sts_display_output.php on line 164

 

Fatal error: main() [function.require]: Failed opening required '' (include_path='.;c:\apachefriends\xampp\php\pear\') in C:\apachefriends\xampp\htdocs\stech\catalog\includes\sts_display_output.php on line 183

Since I am not a php expert I am not sure what is wrong.

I left the sts_templates folder with the osc folder as it is. That means I copied it into the includes folder as with the old version.

 

What have I done wrong? do I need to move the template with all files in it into the includes folder?

 

Regards

 

Pathfinder


Simple Template System (STS)

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

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

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

Share this post


Link to post
Share on other sites

Brian, excellent work on STS! I'm a new osCommerce user and I love it already. :)

 

I've got one little question though, I installed STS 3.0b and I noticed there's a stylesheet in the template directory. Is it being used? As far as I noticed, I still need to edit the stylesheet in the basedir of OSC. Is this an option somewhere? I did a little search but haven't found anything yet.

Share this post


Link to post
Share on other sites
I've got one little question though, I installed STS 3.0b and I noticed there's a stylesheet in the template directory. Is it being used? As far as I noticed, I still need to edit the stylesheet in the basedir of OSC. Is this an option somewhere? I did a little search but haven't found anything yet.

 

 

In v2.0 you edit the style sheet for the template for the STS, the standard stylsheet for the OSC you do not have to touch since wen in debug mode the STS will use that one. 3.0 must me the same.


I'm not a coder just a splicer.

Share this post


Link to post
Share on other sites

I'm a little confused..

I'm new to STS and have downloaded the latest version. I think the fact that the README file is not up to date is adding to my confusion!

I have made changes to the sts stylesheet, but I'm not seeing the changes reflected in my store.

I want to give my entire store a generic design so I don't need multiple templates, however I don't understand which template file I ought to be editing - catalog/includes/sts_templates/osc/sts_template.htm or catalog/includes/sts-template.htm?

I initially started editing catalog/includes/sts-template.htm and saw my stylesheet changes reflected in my store but I wasn't seeing the changes in page structure. Now that I've edited catalog/includes/sts_templates/osc/sts_template.htm I am seeing the changes in structure, but have lost the background colours and fonts as dictated in the stylesheet.

Please help before I get myself in a complete knot!!

Share this post


Link to post
Share on other sites

I'm a little confused..

I'm new to STS and have downloaded the latest version. I think the fact that the README file is not up to date is adding to my confusion!

I have made changes to the sts stylesheet, but I'm not seeing the changes reflected in my store.

I want to give my entire store a generic design so I don't need multiple templates, however I don't understand which template file I ought to be editing - catalog/includes/sts_templates/osc/sts_template.htm or catalog/includes/sts-template.htm?

I initially started editing catalog/includes/sts-template.htm and saw my stylesheet changes reflected in my store but I wasn't seeing the changes in page structure. Now that I've edited catalog/includes/sts_templates/osc/sts_template.htm I am seeing the changes in structure, but have lost the background colours and fonts as dictated in the stylesheet.

Please help before I get myself in a complete knot!!

Share this post


Link to post
Share on other sites

Hi Brian,

 

Thanks for all the hard work - much appreciated.

 

Can I ask a couple of things..

 

1. Does V3 work with HTTP Gzip compression turned on? - previous versions just give a blank page.

2. While talking about speed, did you implement any optimisation on the queries for spee as I notice quite a difference between load speed with and without STS..

 

Cheers

Pete

 

Okay, I put up a beta release for you to start playing with here:

 

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

 

This version moves all the templates files into a new directory structure which you can then switch in code by changing the STS_TEMPLATE_DIR to another directory, the default ("osc") template files have been changed to match the default site look in the product_info templates, and a product_info_debugging template has been added just for the heck of it.

 

The osc Javascript has been moved to /includes/sts_templates/{TEMPLATE}/sts_osc_javascript.js so you can just include that as opposed to pasting stuff into your templates manually.

 

Live PHP code now works in the template (just ignore the fact that they are still called with .html extensions).

 

The category and product_info templating abilities has been improved to allow for heirarchial category templates (if there isn't a template for the current category, it will check to see if there is a template for the parent categories) and products (you can define a product_info template that will be applied to all items in particular categories.

 

Don't have the finer detail level stuff done yet for making the boxes better, and recommend no longer using the $url_* and $urlcat_* tags, but making direct links (see changelog), and templates not yet switchable dynamically.

 

Let me know if you run into any problems with it.

 

CHANGELOG.txt:

 

v3.00

ADD: Dynamic templating abilities with Inline PHP Code in template files

CHG: Change template structure so all templates are encapsulated within their own directory under /includes/sts_templates/{TEMPLATE}

ADD: New DEFINE in configure.php STS_TEMPLATE_DIR to control the directory to take the template from

ADD: Ability to completely turn off STS processing with $no_sts=1 in /includes/application_top.php or as parameter ?no_sts=1

CHG: Move stock osC javascript functions to external file in /includes/sts_templates/{TEMPLATE}/sts_osc_javascript.js

CHG: Only looks up $url_* and $urlcat_* variables if present in the template file

CHG: Recommend not using $url_* and $urlcat_* variables. Recommend instead just using a direct link to the category with an $sid (ie: /index.php?cPath=10&$sid)

ADD: variable $sysmsgs to contain various osCommerce system error messages (ie: bad perms on configuration.php, etc)

ADD: Category and sub-category-based templates. (ie: if cPath=3_10, it will use the first template found of: index.php_3_10.html, index.php_10.html, index.php_3.html, index.php.html and sts_template.html) This allows per-category templates, as well as sub-category templates (categories below the templated one)

ADD: Per-Product and Product-Category-based templates (ie: if cPath=3_10 and ProductID=12, it will use the first template found of: product_info.php_12.html, product_info.php_c3_10.html, product_info.php_c10.html, product_info.php_c3.html, product_info.php.html, sts_template.html). Note that the Per-Product templates for each category and subcategory have a "c" in front of them to distinguish them from the productID-based templates.

ADD: $regularpricestrike variable for product_info.php.html which contains "<s>$regularprice</s>" if a specialprice is set

ADD: Setting debugging info will show the template files being checked for and the one selected

 

README.txt:

 

The readme file has not yet been updated to reflect 3.00 changes

 

Have fun!

 

  - Brian Gallagher

Share this post


Link to post
Share on other sites

Hello Brian,

 

ok.. got the V3 sts running by copying the correct difines from the configure-SAMPLE to the configure.php as you said.

 

Now as I understood I simpley go to the sts_templates/osc folder and edit the sts_template.html.

 

Changing something in the header where the logo is, lets say including a new background image Header_top_left is reflected in the mypath/catalog just in changing the size of the cell. But the image/background is not shown.

 

What have I done wrong?

 

Juergen

Edited by Pathfinder

Share this post


Link to post
Share on other sites

STS 3

 

Hello I have nstalled sts 3.0 and have a very silly question but cant seem to work it out chen I use references like $categoybox

$searchbox etc all I see on my web pahe is $categorybox and $search box any ideas as to why I can see the actual boxes ?

 

Thanks

Ikhan42

Share this post


Link to post
Share on other sites

I just installed the latest version of sts. I followed the instructions in the readme file and tried both the easy and advanced install procedures however in both cases I get the following warnings whenever I load my webpage:

 

Notice: Undefined index: no_sts in c:\easyphp1-8\www\catalog\includes\application_top.php on line 18

 

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\easyphp1-8\www\catalog\includes\application_top.php:18) in c:\easyphp1-8\www\catalog\includes\functions\sessions.php on line 67

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\easyphp1-8\www\catalog\includes\application_top.php:18) in c:\easyphp1-8\www\catalog\includes\functions\sessions.php on line 67

 

Can anybody help?

 

Thanks

Share this post


Link to post
Share on other sites
Hello Brian,

 

ok.. got the V3 sts running by copying the correct difines from the configure-SAMPLE to the configure.php as you said.

 

Now as I understood I simpley go to the sts_templates/osc folder and edit the sts_template.html.

 

Changing something in the header where the logo is, lets say including a new background image Header_top_left is reflected in the mypath/catalog just in changing the size of the cell. But the image/background is not shown.

 

What have I done wrong?

 

Juergen

 

Hello, can please help me someone on that? It is giving me a brakedown :'(

 

Juergen

Share this post


Link to post
Share on other sites

Just wanted to say great idea on parsing php - its working great - just had to put the sts_ file outside the sts directory. Haven't made it to the products yet - but so far so good! :D

Share this post


Link to post
Share on other sites
Hello, can please help me someone on that? It is giving me a brakedown :'(

 

Juergen

 

I'd leave the /sts_templates/osc folder alone so you have a known-working reference point for debugging things later.

 

Make a new directory (ie: /sts_templates/yoursite) and change the STS_TEMPLATE_DIR define in your configure.php file to match it.

 

For the easiest debugging, make all files and links root-relative (ie: <img src="/path/to/image.jpg">) with a leading slash and not http:/ at the beginning. This will make the images show correctly when viewing the templates, in your HTML editor, and in both your regular and SSL versions of the pages.

 

Make changes to the sts_template.html file first, which controls the entire site. After you get that working, then work on category or product templates after the basic one is working. If you are using Dreamweaver, you can even use the Dreamweaver templates feature to design your template pages' general design, if you want a handy way of managing all your STS template files. (Sounds confusing, but is pretty easy).

 

- 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://forums.oscommerce.com/index.php?showtopic=58541

Share this post


Link to post
Share on other sites
Just wanted to say great idea on parsing php - its working great - just had to put the sts_ file outside the sts directory.  Haven't made it to the products yet - but so far so good!  :D

 

Why did you have to put it outside the sts directory?

 

- 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://forums.oscommerce.com/index.php?showtopic=58541

Share this post


Link to post
Share on other sites
Hi Brian,

 

Thanks for all the hard work - much appreciated.

 

Can I ask a couple of things..

 

1. Does V3 work with HTTP Gzip compression turned on? - previous versions just give a blank page.

2. While talking about speed, did you implement any optimisation on the queries for spee as I notice quite a difference between load speed with and without STS..

 

Cheers

Pete

 

1. GZip compression worked when I tried it on my test site.

 

2. So far, just skipping the scan of the category tables unless $url_* or $urlcat_* are being used.

 

If you can identify specific queries that should be optimized, I'll be happy to look into it more. In fact, that would be particularly useful seeing as other people are having different issues than I am with the sites I'm working on.

 

- 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://forums.oscommerce.com/index.php?showtopic=58541

Share this post


Link to post
Share on other sites

Hi all,

 

I'm very eager to try out this contribution and have this downloaded but can anyone kindly update the readme.txt with instructions for installations?

 

Thank you!

Share this post


Link to post
Share on other sites
Hi all,

 

I'm very eager to try out this contribution and have this downloaded but can anyone kindly update the readme.txt with instructions for installations?

 

Thank you!

 

The installation instructions are pretty much the same, except the layout of the template files has changed a bit.

 

Best and easiest way to install:

 

1) Install Clean MS2.2 version

2) Test and see if it works

3) Go into /catalog/includes (or whatever you called it)

4) Extract all the STS3 files from the ZIP file, preserving the directory structure.

5) Copy the define statements from the end of configure-SAMPLE.php to your working configure.php file

6) Test and see if it works

7) Done.

 

You can then start playing with the templates

 

- 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://forums.oscommerce.com/index.php?showtopic=58541

Share this post


Link to post
Share on other sites
Hi all,

 

I'm very eager to try out this contribution and have this downloaded but can anyone kindly update the readme.txt with instructions for installations?

 

Thank you!

 

The installation instructions are pretty much the same, except the layout of the template files has changed a bit.

 

Best and easiest way to install:

 

1) Install Clean MS2.2 version

2) Test and see if it works

3) Go into /catalog/includes (or whatever you called it)

4) Extract all the STS3 files from the ZIP file, preserving the directory structure.

5) Copy the define statements from the end of configure-SAMPLE.php to your working configure.php file

6) Test and see if it works

7) Done.

 

You can then start playing with the templates.

 

I recommend creating/modifying your templates in this order, and one at a time:

 

1) sts_templates.html

 

This sets the general look and feel for your entire site.

This is the only required template.

If you want to further customize your site, then you can also create:

 

2) index.php_0.html

 

This is the template for the home page category

 

3) index.php_???.html

 

These are the templates for specific categories, where ??? should be replaced by the categoryID or cPath for the category

 

4) product_info.php.html

This is the generic product_info template.

 

5) product_info.php_c???.html

 

This lets you set a product_info template by category (note the "c" before the "???"). ??? should be replaced by a category id or cPath.

 

6) product_info.php_???.html

 

This lets you set a product_info template by product id. ??? should be replaced by the product id for the item.

 

7) index.php_mfr.html

 

(New to the version 3.00b2) Lets you define a generic template for the "Search by Manufacturer" pages.

 

8) index.php_mfr_???.html

 

(New to the version 3.00b2) This lets you define a manufacturer template by Manufacturer ID.

 

- 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://forums.oscommerce.com/index.php?showtopic=58541

Share this post


Link to post
Share on other sites

New Simple Template System (STS3) v3.00 Beta 2 Available:

 

New: Manufacturer templates (and manufacturer bugfix from old versions)

 

CHANGELOG.txt from v3.00 Beta 1

CHG: Change samples and live code in sts_user_code to use the defined $sts_block_name variable when assigning values to $template[]

CHG: Detect and user Manufacturer templates when searching by manufacturer. Uses index.php_mfr.html for the default manufacturer template, or index.php_mfr_##.html (replace ## with manufacturer id) for per-manufacturer templates

CHG: Added $templatepath / $templatedir variables for scripting directory location of template files in templates

CHG: Modified .../sts_templates/osc/ templates to use $templatepath variables in templates to specify .js and .css files

ADD: Created copy of .../sts_templates/osc/ in .../sts_templates/mysite/ for a play area, preserving /osc/ for testing

CHG: Modify defaults in configure-SAMPLE.php to use "mysite" template directory

CHG: Quick Install summary in README.txt

ADD: sts_functions.php file for some extra routines that will be used later


Simple Template System (STS)

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

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

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

Share this post


Link to post
Share on other sites

after installing this i get an internet explorer error on each page

 

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

Line: 2

 

Char: 1

 

Error: Syntax error

 

Code: 0

 

URL: http://www... ( What evere page is being viewed )

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

 

 

when i switch to $display_normal_output the problem is gone.

 

any ideas what can be causing this.

 

Cheers

Craig

Share this post


Link to post
Share on other sites

Hi

 

i think this is a new topic, because i didn?t get any result by searching.

 

first of all sorry of my english- i?m not a nativ speaker.

 

I want to integrate osC in another homepage with an iframe.

 

I had the hope, that osc would be trancparent, but it?s not. i?ve got installed sts and so i actually don?t know, if the original Milestone 2.2 ist transparent, but i think not. can someone help me to do this changes in osC, so that it would be transparent. i also looked for an contrib, but i don?t find anyone.

 

another problem by integrating osc in an iframe is ssl. There so many popups, that every customer would run away. ;)

 

many greetings

 

carsten

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

×