Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Simple Template System (sts)


DiamondSea

Recommended Posts

What about templates that use php includes (ie banner / random image)?

 

The sts_template.html ignores my php and so I have a nice blank spot where my image goes. Here's the working version:

 

http://www.bridalworkshop.com/indexnew.php

 

The image directly under the logo is a rotating banner (click refresh a couple times and it will change). But to make this work in the ecommerce section I have to manually enter HTML to a static image. Is there an easy way around this that I'm not thinking of?

 

http://www.bridalworkshop.com/shop/

The template files can not contain executable code, as they are simply read into STS, replace all the variables, and then print it out.

 

If you want to add dynamic content, you could put the code in the sts_user_code.php file and assign it to a new (your own creation) template variable name and then put that variable in your template file.

 

This make any sense?

 

- 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

Thanks for the reply. I've got it. In case anyone wants to know, Here's what I added to /catalog/includes/sts_user_code.php :

 

 $sts_block_name = 'bannerarea';
require(STS_START_CAPTURE);
require(DIR_WS_BOXES . 'banner_box.php');
require(STS_STOP_CAPTURE);
$template['bannerarea'] = strip_unwanted_tags($sts_block['bannerarea'], 'bannerarea');

 

Then I made a file called "banner_box.php" in the /catalog/includes/boxes directory. The file was simply the php code used to insert the rotating banners I use elsewhere on the site.

 

In place of the static image on /catalog/includes/sts_template.html and /catalog/includes/sts_templates/template.php.html I put the text "$bannerarea"

 

Thanks again. Site is almost done and I'm getting very excited as everything comes together!

Edited by Sapro
Link to comment
Share on other sites

Simple Template System (STS) README.txt v1.3

Contribution Author: Brian Gallagher @ DiamondSea.com

Contribution Author Email: [email protected]

 

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

WHAT IT DOES:

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

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

 

You simply create an HTML page that looks the way you want it to and put in

placeholders for the various elements wherever you want to position them.

 

For example, you would put "$cartbox" wherever on the page you want the

Shopping Cart box to appear. Put "$categorybox" where you want the Categories

box to appear. Put "$content" wherever you want the main page

content (the central part where all the magic happens) to appear, etc.

 

It does this by changing only a few /catalog/includes/ files, leaving all

other files untouched, making it easy to add other contributions later.

 

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

BONUS FEATURES: Simple HEADER TAG CONTROLLER Integration

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

This contribution also allows you to use WebMakers.com's

Header Tag Controller contribution without having to modify every file on

the system. Just copy the Header Tag Controller's include files into place

and STS will automatically add them to all pages without having to modify

every PHP script in the /catalog/ directory.

 

STS will auto-detect if Header Tag Controller is installed and use it if

available.

 

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

HOW TO INSTALL:

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

 

Installation Instructions are found in the readme.txt file included in the package. Please read the readme.txt file for a list of installation instructions, new features, new variables and other enhancements to STS.

 

 

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

HOW TO USE:

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

Just modify the

 

/catalog/includes/sts_template.html

 

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

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

like them.

 

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

SUPPORTED TAGS:

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

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

versions):

 

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

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

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

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

working. Sorry!

 

<!--$headcontent--> : You can use this commented format of $headcontent to

keep the word "$headcontent" from displaying in your web authoring software.

 

NOTE: Do not put <title>...</title> tags in your header. It will be added

as part of the $headcontent variable, along with the Description and Keywords

meta tags if you have the WebMakers.com's Header Tag Controller contribution

installed.

 

$cataloglogo: The OSC logo and link

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

$myaccountlogo: The MyAccount graphic and link

$urlmyaccountlogo: The URL used by the My Account function

$cartlogo: The Cart graphic and link

$urlcartlogo: The URL used by the Cart function

$checkoutlogo: The Checkout graphic and link

$urlcheckoutlogo: The URL used by the Checkout function

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

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

$urlmyaccount: The URL used by the MyAccount function.

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

$urlcartcontents: The URL used by the MyAccount function.

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

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

 

$categorybox: The Category box

$manufacturerbox: The Manufacturer box

$whatsnewbox: The What's New box

$searchbox: The Search box

$informationbox: The Information box

$cartbox: The Shopping Cart box

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

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

$bestsellersbox: The Best Sellers box

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

$reviewsbox: The Reviews box

$languagebox: The Languages box

$currenciesbox: The Currencies box

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

$date: The current date

$numrequests: The "XXX requests Since DATE" text

$counter: The page view counter

$footer: The footer output from footer.php

$banner: The banner output from footer.php

 

$sid: The string for the Session ID in the format "SessionIdVarName=WhateverTheSessionIdIs"

 

 

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

DEBUGGING:

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

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

following settings (near the top of the file):

 

$display_template_output = 1;

$display_normal_output = 0;

$display_debugging_output = 0;

 

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

template versions of the pages.

 

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

the pages.

 

Display_Debugging_Output will cause it to display debugging information

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

them into template variables.

 

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

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

 

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

REMOTE DEBUGGING:

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

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

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

 

sts_template=1 Turns on the Template display

sts_template=0 Turns off the Template display

sts_normal=1 Turns on the Normal display

sts_normal=0 Turns off the Normal display

sts_debug=1 Turns on the Debugging display

sts_debug=0 Turns off the Debugging display

sts_version=1 Turns on Version Number display

sts_version=0 Turns off Version Number display

 

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

SUPPORT:

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

 

For support, please post to this thread.

it may be a stupid question....but i cant seem to change the logo on the page no matter what. in fact, i had deleted the entire content outta the header.php file in the include folder. the default oscommerce.gif just doesnt go away! can someone explain to me how these $ tags work? where to change the default values of each. i really cant figured out after a few painful hours of trying. thx much!

Link to comment
Share on other sites

First of all, that is the README.txt file for version 1.3. The current version is 2.01 and has it's own README.txt file in the STS_201.ZIP that you should use instead.

 

Second, the whole point of STS is that you don't have to go in and change all the code in the PHP files. If you want to change the logo, just go into the sts_template.html file that comes with it and delete the $catlogo box and just put your own graphics in, just like you would with a normal HTML page.

 

Basically, STS lets you control the layout of all the page elements just by changing where (or if) they appear in the sts_template.html file.

 

This help?

 

- 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

Warning: main(STS_START_CAPTURE): failed to open stream: No such file or directory in /home/o0o/public_html/shop/includes/application_top.php on line 511

 

Fatal error: main(): Failed opening required 'STS_START_CAPTURE' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/o0o/public_html/shop/includes/application_top.php on line 511

 

Can someone please help me thanks...

Edited by eckotm
Link to comment
Share on other sites

Disabling the notifications box:

 

I'm trying to disable the notifications box in the right column. I'm running STS with the latest version of OScommerce. The only place I see to disable it is in the left_column file. I don't have it set in the right_column file at all. Here is the code in left_column that I put in. I can either disable notifications and the bestsellers box but not just the notifications box:

 

if (isset($HTTP_GET_VARS['products_id'])) {

if (tep_session_is_registered('customer_id')) {

$check_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "' and global_product_notifications = '1'");

$check = tep_db_fetch_array($check_query);

if ($check['count'] > 0) {

include(DIR_WS_BOXES . 'best_sellers.php');

} //else {

//include(DIR_WS_BOXES . 'product_notifications.php');

}

} //else {

//include(DIR_WS_BOXES . 'product_notifications.php');

}

} else {

include(DIR_WS_BOXES . 'best_sellers.php');

}

 

I try this above or I set all possibilities to only include best_sellers.php and still I can't get it to work. I would like to keep bestsellers on all pages but I wan't to completely disable this notifications box.

 

Thanks,

 

JohnQuest

Link to comment
Share on other sites

Cool Menu!!

DiamondSea

 

I found a big factor in the problem

 

I'm sure you can figure out the rest...

 

 

 

sts_template.html<------ITS AN HTML

it cannot execute the <php command require!

 

resave the document as sts_template.php <---PHP

 

change the files in the configure.php and...

 

here i get stuck

 

 

You CAN SOLVE THIS and be rid of HUNDREDS OF THREADS!!!!!

!!!!!!!!!!!!!

!!!!!!!!!!!

 

 

 

Thanks,

Yosi

Link to comment
Share on other sites

First of all, that is the README.txt file for version 1.3.  The current version is 2.01 and has it's own README.txt file in the STS_201.ZIP that you should use instead.

 

Second, the whole point of STS is that you don't have to go in and change all the code in the PHP files.  If you want to change the logo, just go into the sts_template.html file that comes with it and delete the $catlogo box and just put your own graphics in, just like you would with a normal HTML page.

 

Basically, STS lets you control the layout of all the page elements just by changing where (or if) they appear in the sts_template.html file.

 

This help?

 

- Brian

Hello Diamond Sea,

 

I installed(settled) the version 2.01 and everything works well.

 

The problem what I have is that templates is not used with STS TEMPLATE use pages sts_templates/index.php.html in the directory of template?

 

He always uses sts_template.html in the directory includes

 

You would have a suggestion for solved the problem.

 

Thank you for your answer.

Link to comment
Share on other sites

I am wanting to try out the new version of STS now that it also supports the product info pages. Only thing is that I have a few contributions installed that I am not sure it will work with. Like the Articles Contribution. How would I go about getting STS to work with that? I would imagine its not too hard to do since article_info.php is almost identical to product_info.php.

 

Also, will this new version support information pages? Like the Contact Page, Privacy Notice, etc? Plus I made a few of my own information pages.

 

Finally, I have Centershop Installed. Will I need to uninstall that first, or can I just shut it off?

Link to comment
Share on other sites

I don't see where to download the latest version (1.4). I went to the download site and downloaded what showed to be the latest but it is actually marked:

 

sts_display_output.php,v 1.2 2004/02/05 05:57:12

 

Thanks.

You can download it from the address in my signature, or just go to http://www.SimpleTemplateSystem.com and find it there (it will point you to the OSC contributions area link)

 

- 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 making a great deal of progress with the STS templates. I love it!

 

In setting up the product_info template I am having a problem getting the Reviews button to work.

 

What is the correct layout on the product page using the tags:

 

$reviews

$reviewsbutton

$reviewsurl

 

When I use $reviewsbutton it just shows the button with no link....

 

When I use $reviewurl it shows the url link on the page....

 

Can see what I am talking about at By The Vineyard STS Implemented Pages

 

Thanks for any help!

Link to comment
Share on other sites

Found it.

 

If anybody else has a problem getting the reviews button to work with STS, this is how it should look:

 

$reviews<br><a href=$reviewsurl>$reviewsbutton</a><br>

 

Thanks all.

Link to comment
Share on other sites

I install new sts and sts_template.html works ok when i change it my shop layout change cool

but sts_product_info.php.html not works i tryed copy it to sts_templates/ to main includes/ and when i edit it products page wont change.

2 when i delete sts_product_info.php from configure.php STS works still with no errors and display products from like sts_template.html

What am doing wrong I install all like in readme and ??????

Link to comment
Share on other sites

I install new sts and sts_template.html works ok when i change it my shop layout change cool

but sts_product_info.php.html not works i tryed copy it to sts_templates/ to main includes/ and when i edit it products page wont change.

2 when i delete sts_product_info.php from configure.php STS works still with no errors and display products from like sts_template.html

What am doing wrong I install all like in readme and ??????

Link to comment
Share on other sites

Displaying STS files locally.

 

I understand using absolute & relative addressing but in order for me to use my sts_template page locally for testing I have to use a link to a graphic below as an example.

 

file:///D:/Web_Sites/DVBHardware/DVBHardware/catalog/includes/sts_template/top_banner.gif

 

instead of:

/catalog/includes/sts_template/top_banner.gif

 

Is there an apache or php configuration setting I am missing ? Everything else is working fine. I am using http://localhost:82/dvbhard/ as the root using virtual directories.

 

This can be a real pain when using many graphics, and when I am happy with the output I have to go back and change all of them before uploading to the server that is hosting the site.

 

DVBHardware.com

 

Thanks

I'm not a coder just a splicer.

Link to comment
Share on other sites

sirwiz,

 

I had that same problem.

 

To Fix:

 

If you install 2.01 and the fix for popups you have to go back in to sts_display_output and make it set the $scriptbasename variable. It has commented out the lines that set the variable.

 

Add the three commented out lines back in, before the fix....

 

You have to put the three commented out lines directly before it reset the other scriptname variables....

 

This makes it work perfectly.

 

Can see my implementation at Example of Product Layout Implementation

Edited by bythevineyard
Link to comment
Share on other sites

bythevineyard,

 

yes i install 2.01 and popup fix but i don't see any commented out lines maybe im blind but hmm plis tell me step after step what i must do to use product_info template or send me working version of sts_display_output with short info

 

thx

Link to comment
Share on other sites

I have installed sts and it seemed to have gone in flawlessly. I am having trouble just changing the main logo on my site (oscommerce banner at the top) by following the conventional manner. Is there something else I should be goin to change that since I have STS. Something like changing a banner should be easy and this is frustraiting me bigtime.

 

Thanks!

Link to comment
Share on other sites

I have installed sts and it seemed to have gone in flawlessly. I am having trouble just changing the main logo on my site (oscommerce banner at the top) by following the conventional manner. Is there something else I should be goin to change that since I have STS. Something like changing a banner should be easy and this is frustraiting me bigtime.

 

Thanks!

Two choices you can just add the link directly to the sts_template file.html file or you can change it in the sts_display_output.php file

The Knowledge Base is a wonderful thing.

Do you have a problem? Have you checked out Common Problems?

There are many very useful osC Contributions

Are you having trouble with a installed contribution? Have you checked out the support thread found Here

BACKUP BACKUP BACKUP!!! You did backup, right??

Link to comment
Share on other sites

Hey folks! I just love STS - however I am encountering one issue. I would like to add HEADING_TITLE to the title bar of the pages like conditions.php and shipping.php. I am using the Heading Tags controller however it doesn't control those pages.

 

I tried the suggestion of adding this to sts_display_output.php:

 

$template['title'] = (HEADING_TITLE);

 

Then I changed the Heading Tag Controller code to:

 

  } else {
   echo "<title>" . TITLE . $title . "</title>";
 }

 

I guess it doesn't know what the HEADING_TITLE is yet. Any suggestions?

 

Thanks!

Link to comment
Share on other sites

bythevineyard -

 

I'm having the same problem you did with STS not showing my product_info.php.html template. It always shows my default template. It does, however, use my template correctly for index.php_0.html, so I feel like the install is good. Now I'm trying to do the fix you suggest, but with no luck. Please tell me if the correct lines are uncommented in my example below:

 

/////////////////////////////////////  ERROR FIXED by Walo /////////////
/////////////////////////////////////////  ERROR FIXED by Walo /////////////
/////////////////////////////////////////  ERROR FIXED by Walo /////////////
// Override if we need to show a pop-up window

//uncommented the following three lines
$scriptname = $_SERVER['PHP_SELF'];
$scriptname = getenv('SCRIPT_NAME');
$scriptbasename = substr($scriptname, strrpos($scriptname, '/') + 1);

// If script name contains "popup" then turn off templates and display the normal output
// This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly
//if (strpos($scriptname, "popup") !== false || strpos($scriptname, "info_shopping_cart") !== false) {
//$display_normal_output = 1;
//$display_template_output = 0;
//}
/////////////////////////////////////////  ERROR FIXED by Walo /////EOF/////



// Override if we need to show a pop-up window
$scriptname = $_SERVER['PHP_SELF'];
$scriptname = strstr($scriptname, "popup");
$scriptname2 = strstr($scriptname, "info_shopping_cart");
// If script name contains "popup" then turn off templates and display the normal output
// This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly
if ($scriptname != false || $scriptname2 != false) {
$display_normal_output = 1;
$display_template_output = 0;
}

 

I could be that I have a different issue, but this seems to be affecting several people. Any other suggestions?

 

Thanks,

Jim

Link to comment
Share on other sites

Is STS compatable with the Pay Pal IPN ?

 

Ive Installed The STS and Love it for the ease of editing the layout of my store.

But after I Installed thr PayPal IPN I Receive the follownig error:

Fatal error: Call to a member function on a non-object in /home/rain/public_html/shop/includes/sts_display_output.php on line 217

 

I have Installed STS and had It working fine without paypal then installed paypal and got the eror. Then Installed PayPal without STS and it works fine. But with both installed no luck. I Installed STS using Advanced mode(with the help of compare& merge"great prog") to be sure not to over write anything possibly added from paypal IPN

 

 

url to store:essential mother store

test customer:

email:[email protected]

pass:qwerty

 

 

Thank you!

 

Bill

Link to comment
Share on other sites

Fatal Error?

 

I have a bunch of contribs installed, nad have had no problem sts_user_code.php to get them appearing in my STS template... all but one: Article Manager.

 

Here is the code in sts_usercode.php:

	$sts_block_name = 'articles';
   require(STS_START_CAPTURE);
   require(DIR_WS_BOXES . 'articles.php');
   require(STS_STOP_CAPTURE);
   $template['articles'] = strip_unwanted_tags($sts_block['articles'], 'articles');

 

Looks normal to me. I stick a $articles variable in the template, and upload it all only to get this:

 

Fatal error: Cannot redeclare tep_show_topic() (previously declared in /nfs/home/user/public_html/catalog/includes/boxes/articles.php:13) in /nfs/home/user/public_html/catalog/includes/boxes/articles.php on line 13

 

Hmmm..... anyone else have/solve this problem?

Link to comment
Share on other sites

Here is the code in sts_usercode.php:

	$sts_block_name = 'articles';
? ?require(STS_START_CAPTURE);
? ?require(DIR_WS_BOXES . 'articles.php');
? ?require(STS_STOP_CAPTURE);
? ?$template['articles'] = strip_unwanted_tags($sts_block['articles'], 'articles');

Try naming the sts block articles_box instead of articles. I think articles is already a variable being used.

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