Jump to content
DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

i installed this contribution and works great! except one problem,

 

before login account has my account link on the header ,and after login only logoff left , my account link is no longer there.

 

how can i do that even customer login , the logoff and my account can appear at the same time not only logoff link.

 

 

 

i think this is the code should change in the sts_display_output.php :

 

if (tep_session_is_registered('customer_id')) {

$template['myaccount'] = '<a href=' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . ' class="headerNavigation">' . HEADER_TITLE_LOGOFF . '</a>';

$template['urlmyaccount'] = tep_href_link(FILENAME_LOGOFF, '', 'SSL');

} else {

$template['myaccount'] = '<a href=' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . ' class="headerNavigation">' . HEADER_TITLE_MY_ACCOUNT . '</a>';

$template['urlmyaccount'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');

}

 

 

i don;t know how to do that?

 

anybody help me plz??

 

 

thanks

sean

Share this post


Link to post
Share on other sites

Any stupid error.....

 

You work it's really a great contribution for all community.

For this contibution go to best, it's need some fails, some reports of errors, and colaborative.

 

Excuse for my bad english.

Share this post


Link to post
Share on other sites
Thank you Brian, great contribution.

 

You can see STS 1.4 implementation in action on my demo site.

Can you pass along the css for how you do the broken vertical line separating the left side column with the main body?

 

I am building a site http://www.guatemalafairtrade.com -- using sts -- I am fooling around with dropping the right side -- today's iteration has both sides. I will probably lose it but sts allows such fast changes allowing me easy prototyping.

 

However, I can't seem to lose the space between the header and what falls below it. I noticed in your site the header is contiguous. How can I get rid of the space?

 

thanks,

Murray

Share this post


Link to post
Share on other sites

I want to lose the right column and would like the cart box to work in a popup window when calling $cartbox -- Anyone have a suggestion for a way to bring that up in a small window of it's own?

thanks,

Murray

Share this post


Link to post
Share on other sites
and if you don't want the comments there at all change it to

  // If empty, return nothing
 if ($tablestart === false) {
	 return  "\n";
 }

 

 

Great fix  :D  Thanks for working on it.

 

I thought about doing that, but decided against it because the bandwidth impact is minimal and it will make debugging a real pain without it. The javascript fix is sort of a kludge and I anticipated having problems with it (as we just saw), so I wanted to leave that in there so I (and you) could easily identify exactly where problems were coming from when they arise.

 

Is it possible to use php in the sts_template? or does anyone know how I could make it so that the "My Account" etc only displays when the user is logged in?

 

I don't need to know the code, just where abouts I could edit it.

 

thanks  :)

 

You CAN NOT/b] use PHP in the template.php file, because it is not actually processed by the PHP compiler, only read in as a text file.

 

You CAN use client-side javascript, however, and it will be executed as expected. You may be able to use this to duplicate the functionality that you might try to get out of your PHP scripting you wanted to do.

 

- 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
I want to lose the right column and would like the cart box to work in a popup window when calling $cartbox -- Anyone have a suggestion for a way to bring that up in a small window of it's own?

thanks,

Murray

Probably the next version of STS will have a feature that was requested earlier, the ability to have multiple template pages for different pages.

 

Once this is done, you'll be able to specify a template page with nothing on it but the $cartbox and open that page in a pop-up window.

 

I'm still working on the best way of implementing it, but it will probably be done soon.

 

(Just to keep you in suspense....)

 

- 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
Thank you Brian, great contribution.

 

You can see STS 1.4 implementation in action on my demo site.

Can you pass along the css for how you do the broken vertical line separating the left side column with the main body?

 

I am building a site http://www.guatemalafairtrade.com -- using sts -- I am fooling around with dropping the right side -- today's iteration has both sides. I will probably lose it but sts allows such fast changes allowing me easy prototyping.

 

However, I can't seem to lose the space between the header and what falls below it. I noticed in your site the header is contiguous. How can I get rid of the space?

 

thanks,

Murray

Hi Murray,

you can download style.css and sts_template.html (ziped) HERE.


_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/

(\__/)

(O.o )

(> < )

Share this post


Link to post
Share on other sites

Hello,

I just saw that lovely mighty contribution STS template System and I

was excited. I treid to install like described in the advanced section of the readme

file. After changing all necessary files I started my shop runninjg on localhost:

 

Following Error message appeared:

 

 

 

Warning: main(includes/functions/clean_html_comments.php) [function.main]: failed to create stream: No such file or directory in d:\workbench\htdocs\shops\www.sister-shop.de\includes\sts_display_output.php on line 99

 

Fatal error: main() [function.main]: Failed opening required 'includes/functions/clean_html_comments.php' (include_path='.;c:\php4\pear') in d:\workbench\htdocs\shops\www.sister-shop.de\includes\sts_display_output.php on line 99

 

 

 

I was looking for the clean_html_comments.php but I coulnd find it in my OSC MS 2.2 Installattion. Where is this file? Can you please help me? :(

 

 

Bye

 

Martin

Share this post


Link to post
Share on other sites
A dumb question.

 

Where I can put personalized headers on osCommerce?

 

I need some module?

If you're talking about customer <title> and <meta> tags, get the Header Tags Controller contribution: http://www.oscommerce.com/community/contributions,207

 

There are two parts, the /catalog/ side of it and the /admin/ side of it. You'll want to install the admin side of it, run the SQL in it to add the new fields (title, description and keywords) to the database, and copy the /catalog/includes/ files for it into place in both the /admin/ and /catalog/ sides.

 

You DO NOT have to modify all the /catalog/ files. STS should detect that it is installed and use it for you automatically (assuming it is in the expected places).

 

- 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
Hello,

I just saw that lovely mighty contribution STS template System and I

was excited. I treid to install like described in the advanced section of the readme

file. After changing all necessary files I started my shop runninjg on localhost:

Following Error message appeared:

Warning: main(includes/functions/clean_html_comments.php) [function.main]: failed to create stream: No such file or directory in d:\workbench\htdocs\shops\www.sister-shop.de\includes\sts_display_output.php on line 99

 

Fatal error: main() [function.main]: Failed opening required 'includes/functions/clean_html_comments.php' (include_path='.;c:\php4\pear') in d:\workbench\htdocs\shops\www.sister-shop.de\includes\sts_display_output.php on line 99

I was looking for the clean_html_comments.php but I coulnd find it in my OSC MS 2.2 Installattion. Where is this file? Can you please help me? :(

Bye

Martin

Since you are doing the advanced install, I assume that you have other contributions installed already? If not, just do an easy install. It's, well, easier. :) If so, is the Header Tag Controller one of them? The error you are getting is being triggered because STS thinks you have the Header Tag Controller contribution installed and is trying to run it.

 

If you aren't using it and don't plan to, you can remove this block of code from your /catalog/includes/sts_display_output.php script:

/////////////////////////////////////////////
////// Capture <title> and <meta> tags
/////////////////////////////////////////////

// STS: ADD: Support for WebMakers.com's Header Tag Controller contribution
 // Capture the output
 require(STS_START_CAPTURE);

 // BOF: WebMakers.com Changed: Header Tag Controller v1.0
 // Replaced by header_tags.php
 if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
   require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
   require(DIR_WS_FUNCTIONS . 'header_tags.php');
   require(DIR_WS_INCLUDES . 'header_tags.php');
 } else {
   echo "<title>" . TITLE . "</title>";
 }
 // EOF: WebMakers.com Changed: Header Tag Controller v1.0

 $sts_block_name = 'headertags';
 require(STS_STOP_CAPTURE);

// STS: EOADD: Support for WebMakers.com's Header Tag Controller contribution

 

What is happening is that STS sees that you have a file on your system /catalog/includes/header_tags.php, which is part of the Header Tag Controller contribution. Does this file exist on your machine? If it does, STS expects the rest of the files to be there as well.

 

Another possibility is that you are using an older version of PHP where the require() function worked differently than the latest versions (4.0.3+?) and it is failing due to the change in how require() works in your old version. If this is the case remove the code or upgrade your version of PHP.

 

I recommend the Header Tag Controller contribution if you're interested in improving your OSC products' relevance and popularity in the search engines (like Google). Read the post just before this one for more details on how it works with STS. You can find it here: http://www.oscommerce.com/community/contributions,207

 

- 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

I just upgraded to STS 1.6 and have everything in working order and I am generally in love with this contribution. However, there is one irritating little issue that I haven't been able to resolve, so I am appealing to you all for help.

 

My template has a border on the top and left side, which wraps around the content ($content). I would like the content to be flush with the template, but while the left side lines up fine, there is a space of roughly 100 pixels between the top border and where the content begins.

 

Through trial and error, I found that the space would disappear when I removed <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> from the content page code (i.e. conditions.php). Of course, then my infobox information vanishes as well. But at least I've isolated the problem, I think. Now, does anyone have any ideas as to how I can get rid of this pesky space?

Share this post


Link to post
Share on other sites
I just upgraded to STS 1.6 and have everything in working order and I am generally in love with this contribution. However, there is one irritating little issue that I haven't been able to resolve, so I am appealing to you all for help.

 

My template has a border on the top and left side, which wraps around the content ($content). I would like the content to be flush with the template, but while the left side lines up fine, there is a space of roughly 100 pixels between the top border and where the content begins.

 

Through trial and error, I found that the space would disappear when I removed <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> from the content page code (i.e. conditions.php). Of course, then my infobox information vanishes as well. But at least I've isolated the problem, I think. Now, does anyone have any ideas as to how I can get rid of this pesky space?

Can you post a link to the site and the template file?

 

- Brian


Simple Template System (STS)

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

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

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

Share this post


Link to post
Share on other sites

This may help other users:

 

after installing STS in a productive environment the payment module (worldpay) was completely confused - the proper returning to the "success-page" was impossible. After a looong loong night of searching into the involved programm-modules I found the reason:

 

In the finishing part of the payment are some informations needed who are located into the header - and therefore eliminated by the sts_display_output.php .

 

The need was now to display most pages of the shop with STS - but - with some exeptions ! (This may also be a need for other reasons)

 

The solution i realised is the following:

 

In sts_display_output.php - (in my file around line 34 - directly after the statement for overriding for popups)

 

Insert the following lines:

 

// override if $notemplate is set in the page **********

if(isset($notemplate) && $notemplate == "YES") {

$display_template_output = 0;

$display_normal_output = 1;

}

// **** end notemplate-mod RE

 

In all .php who are to display without STS - somwhere in the beginning of the codepart

 

Insert the following line(s)

 

// ****** flag to prevent STS template-system

$notemplate = "YES";

// ****** end

 

Perhaps this may help others who have similar problems. There are for sure more clever solutions possible, but for this "payment-problem" it was helpfull.

Share this post


Link to post
Share on other sites

PB with mod STS1.6 !

 

without $categorybox and just a text it's ok :

20.jpg

 

but with $categorybox i have a pb in right and i don't know how modify this ?

21.jpg

 

HELP

Share this post


Link to post
Share on other sites
PB with mod STS1.6 !

 

without $categorybox and just a text it's ok :

but with $categorybox i have a pb in right and i don't know how modify this ?

HELP

I'm not sure what PB is. Have you changed the code for the $categorybox?

 

If you turn on debugging, are there any <td> or <tr> codes before or after the table for the $sts_block[categorybox] variable? Are they still there in the $template[categorybox] variable below it?

 

Alternatively, post a link to the catalog page and I can take a look from here.

 

- 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
PB with mod STS1.6 !

 

without $categorybox and just a text it's ok :

but with $categorybox i have a pb in right and i don't know how modify this ?

Guillaume

 

This looks like a table problem -- My guess is that your template has an extra <td>

If you can post your template code, I or someone else might have a better idea.

Share this post


Link to post
Share on other sites

ok code categorie:

function tep_show_category($counter) {
   global $tree, $categories_string, $cPath_array;

   for ($i=0; $i<$tree[$counter]['level']; $i++) {
     $categories_string .= "  ";
   }

   $categories_string .= '<a href="';

   if ($tree[$counter]['parent'] == 0) {
     $cPath_new = 'cPath=' . $counter;
   } else {
     $cPath_new = 'cPath=' . $tree[$counter]['path'];
   }

   $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

   if (isset($cPath_array) && in_array($counter, $cPath_array)) {
     $categories_string .= '<b>';
   }

// display category name
   $categories_string .= $tree[$counter]['name'];

   if (isset($cPath_array) && in_array($counter, $cPath_array)) {
     $categories_string .= '</b>';
   }

   if (tep_has_category_subcategories($counter)) {
     $categories_string .= '->';
   }

   $categories_string .= '</a>';

   if (SHOW_COUNTS == 'true') {
     $products_in_category = tep_count_products_in_category($counter);
     if ($products_in_category > 0) {
       $categories_string .= ' (' . $products_in_category . ')';
     }
   }

   $categories_string .= '<br>';

   if ($tree[$counter]['next_id'] != false) {
     tep_show_category($tree[$counter]['next_id']);
   }
 }
?>
<!-- categories //-->
         
<?php 
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

new infoBoxHeading($info_box_contents, true, true);

 $categories_string = '';
 $tree = array();

 $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
 while ($categories = tep_db_fetch_array($categories_query))  {
   $tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                               'parent' => $categories['parent_id'],
                                               'level' => 0,
                                               'path' => $categories['categories_id'],
                                               'next_id' => false);

   if (isset($parent_id)) {
     $tree[$parent_id]['next_id'] = $categories['categories_id'];
   }

   $parent_id = $categories['categories_id'];

   if (!isset($first_element)) {
     $first_element = $categories['categories_id'];
   }
 }

 //------------------------
 if (tep_not_null($cPath)) {
   $new_path = '';
   reset($cPath_array);
   while (list($key, $value) = each($cPath_array)) {
     unset($parent_id);
     unset($first_id);
     $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
     if (tep_db_num_rows($categories_query)) {
       $new_path .= $value;
       while ($row = tep_db_fetch_array($categories_query)) {
         $tree[$row['categories_id']] = array('name' => $row['categories_name'],
                                              'parent' => $row['parent_id'],
                                              'level' => $key+1,
                                              'path' => $new_path . '_' . $row['categories_id'],
                                              'next_id' => false);

         if (isset($parent_id)) {
           $tree[$parent_id]['next_id'] = $row['categories_id'];
         }

         $parent_id = $row['categories_id'];

         if (!isset($first_id)) {
           $first_id = $row['categories_id'];
         }

         $last_id = $row['categories_id'];
       }
       $tree[$last_id]['next_id'] = $tree[$value]['next_id'];
       $tree[$value]['next_id'] = $first_id;
       $new_path .= '_';
     } else {
       break;
     }
   }
 }
 tep_show_category($first_element); 

 $info_box_contents = array();
 $info_box_contents[] = array('text' => $categories_string);

 new infoBox($info_box_contents); 
?>
           
<!-- categories_eof //-->

 

And template html section categories:

 

<!-- categories //-->
   <TR>
	 <TD HEIGHT="29" ALIGN="CENTER" VALIGN="MIDDLE" STYLE="background: url(images/design/menu_top_right.jpg) no-repeat left top;font-family: Tahoma, Verdana, Arial, sans-serif;font-size: 11px;font-weight: bold;color: #1F5363;">Categories</TD>
         </TR>
         <TR>
           <TD VALIGN="TOP">
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBox_categ">
 <tr>
   <td><table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBoxContents_categ">
 <tr>
   <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>
 </tr>
 <tr>
   <td class="boxText_categ"><TABLE BORDER="0" WIDTH="186" CELLSPACING="0" CELLPADDING="0">$categorybox</TABLE></td>
 </tr>
 <tr>
   <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>
 </tr>
</table>
</td>
 </tr>
</table>
           </TD>
         </TR>
<!-- categories_eof //-->

Share this post


Link to post
Share on other sites

An easier way to find the problem is to turn on STS debugging and post the results of the sts_block[categorybox] and template[categorybox] values. This is where the problem most likely can be found.


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

I have just done install(advanced) using the compare and merge

tool(cool) but I am getting the following error message....

 

Warning: main(includes/sts_restart_capture.php) [function.main]: failed to create stream: No such file or directory in c:\program files\apache group\apache\htdocs\catalog\includes\header.php on line 15

 

Fatal error: main() [function.main]: Failed opening required 'includes/sts_restart_capture.php' (include_path='.;c:\php4\pear') in c:\program files\apache group\apache\htdocs\catalog\includes\header.php on line 15

 

Help please :D

Cheers Malc

Share this post


Link to post
Share on other sites

Hi

Ok guys panic over :blink: I have sorted it out .... one other prob though... in readme file...

 

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

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;

 

cant find this????

 

Cheers Malc

Share this post


Link to post
Share on other sites
Hi

Ok guys panic over  :blink: I have sorted it out .... one other prob though... in readme file...

 

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

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;

 

cant find this????

 

Cheers Malc

That code has been moved to sts_display_output.php. Look for it there.

 

Sorry about that. I'll update the README.

 

- 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

First of all, THNX 4 this great(est) contribution Brian

 

I am using STS 1.6.

 

When installed Header Tags Controller 2.1 for MS 2.2 I get the following errors:

 

Fatal error: Cannot redeclare clean_html_comments() (previously declared in /opt/guide/www.domainname.com/catalog/includes/functions/clean_html_comments.php:13) in /opt/guide/www.domainname.com/catalog/includes/functions/clean_html_comments.php on line 13

 

Anyone got an idea how to solve this.

 

THNX in advance.

Share this post


Link to post
Share on other sites
First of all, THNX 4 this great(est) contribution Brian

 

I am using STS 1.6.

 

When installed Header Tags Controller 2.1 for MS 2.2 I get the following errors:

 

Fatal error: Cannot redeclare clean_html_comments() (previously declared in /opt/guide/www.domainname.com/catalog/includes/functions/clean_html_comments.php:13) in /opt/guide/www.domainname.com/catalog/includes/functions/clean_html_comments.php on line 13

 

Anyone got an idea how to solve this.

 

THNX in advance.

Did you install it according to the it's own instructions or STS's instructions?

 

If you modified every PHP file in your /catalog/ directory, you did it wrong (and wasted lots of time). Put all your original /catalog/*.php files back and it will probably work.

 

STS makes the changes for you.

 

- 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
Did you install it according to the it's own instructions or STS's instructions?

Installed according to the STS's instructions, so uploaded 4 files

/catalog/includes/header_tags.php

/catalog/includes/languages/english/header_tags.php

/catalog/includes/functions/clean_html_comments.php

/catalog/includes/functions/header_tags.php

 

Adding 3 new fields to products_description table

 

and modified the /catalog/includes/application_top.php

 

If you modified every PHP file in your /catalog/ directory, you did it wrong (and wasted lots of time).? Put all your original /catalog/*.php files back and it will probably work.

It was your readme file that pointed out HTC in the first place, so didn't make that mistake

 

STS makes the changes for you.

I left out the modification of the application_top.php, and then there are no errors!

 

But then HTC doesn't work or will it work without this modification?

 

Thnx

Edited by ChA0s

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

×