Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Simple Template System (sts)


DiamondSea

Recommended Posts

Hi Brian,

 

Since you're in here I'm hoping I can pick your brain as well. Are there plans to incorporate some of the individual product_info.php template solutions into STS or is there a particular method you'd recommend or have used?

 

Thanks!

Iggy

I've been off here for a while. Which solutions are you looking to have added?

 

Links to a post or copy/paste would be helpful so I know what everybody's looking for. :-)

 

- 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

guyes, still cant figure ou what to do. i need to have dynamic page titles unlike the static page title mentioned in sts_template.html file. how do i want that product name is in the title of the page. plz help.

If you're using the product_info.php.html templates, just put $productname in your <title> tags like this:

 

<title>$productname - YourSite.com</title>

 

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

Link to comment
Share on other sites

Thanks for the replies Iggy and Kevin, my current problems exist specifically with contribs which involve the product_info.php. I would like to take advantage of using the sts templates for making new product info pages but I really can't use the sts product info pages unless the contribs are working on them.

 

After exhausting most of the reading material on the subject at these forums I tried adding the extra contrib code which I hacked into the product_info.php to originally get the contribs to work, and copying that code into the sts version of the product_info. I used the attributes code in the sts product_info as a guide for the format, removing all the <?php ?> tags etc.

 

For example with Master Products I used the below code from the product_info.php

//START MASTER PRODUCTS
//a check to see if there are slave products and if so check if they are active(product_status) if not don't activate the slave section

$master_product_query=tep_db_query("select p.products_status, p2m.master_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_MASTER . " p2m where master_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id=p2m.slave_id and p.products_status = '1'");
if (tep_db_num_rows($master_product_query) > 0) {
?>
     <tr>
       <td><?php echo TEXT_OPTIONS?></td>
     </tr>
<?php
// create column list
   $define_list = array('PRODUCT_LIST_MODEL' => SLAVE_LIST_MODEL,
                        'PRODUCT_LIST_NAME' => SLAVE_LIST_NAME,
                        'PRODUCT_LIST_MANUFACTURER' => SLAVE_LIST_MANUFACTURER,
                        'PRODUCT_LIST_PRICE' => SLAVE_LIST_PRICE,
                        'PRODUCT_LIST_QUANTITY' => SLAVE_LIST_QUANTITY,
                        'PRODUCT_LIST_WEIGHT' => SLAVE_LIST_WEIGHT,
                        'PRODUCT_LIST_IMAGE' => SLAVE_LIST_IMAGE,
                        'PRODUCT_SLAVE_BUY_NOW' => SLAVE_LIST_BUY_NOW);

   asort($define_list);

   $column_list = array();
   reset($define_list);
   while (list($key, $value) = each($define_list)) {
     if ($value > 0) $column_list[] = $key;
   }

   $select_column_list = '';

   for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
     switch ($column_list[$i]) {
       case 'PRODUCT_LIST_MODEL':
         $select_column_list .= 'p.products_model, ';
         break;
       case 'PRODUCT_LIST_NAME':
         $select_column_list .= 'pd.products_name, ';
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $select_column_list .= 'm.manufacturers_name, ';
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $select_column_list .= 'p.products_quantity, ';
         break;
       case 'PRODUCT_LIST_IMAGE':
         $select_column_list .= 'p.products_image, ';
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $select_column_list .= 'p.products_weight, ';
         break;
     }
   }

   $listing_sql = "select " . $select_column_list . " p.products_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, pm.master_id, pm.slave_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_MASTER . " pm, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id=pm.slave_id and pm.master_id='" . (int)$HTTP_GET_VARS['products_id'] . "'";

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;
       }
     }
   } else {
     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);
     $listing_sql .= ' order by ';
     switch ($column_list[$sort_col-1]) {
       case 'PRODUCT_LIST_MODEL':
         $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_NAME':
         $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_IMAGE':
         $uni .= "pd.products_name";
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_PRICE':
         $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
     }
   }
?>

     <tr>
       <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>
     </tr>

<?php
}
//END MASTER PRODUCTS

 

Then added this code to sts_product_info.php

//START MASTER PRODUCTS
//a check to see if there are slave products and if so check if they are active(product_status) if not don't activate the slave section

$master_product_query=tep_db_query("select p.products_status, p2m.master_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_MASTER . " p2m where master_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id=p2m.slave_id and p.products_status = '1'");
if (tep_db_num_rows($master_product_query) > 0) {
$template['textoptions'] = TEXT_OPTIONS;

// create column list
   $define_list = array('PRODUCT_LIST_MODEL' => SLAVE_LIST_MODEL,
                        'PRODUCT_LIST_NAME' => SLAVE_LIST_NAME,
                        'PRODUCT_LIST_MANUFACTURER' => SLAVE_LIST_MANUFACTURER,
                        'PRODUCT_LIST_PRICE' => SLAVE_LIST_PRICE,
                        'PRODUCT_LIST_QUANTITY' => SLAVE_LIST_QUANTITY,
                        'PRODUCT_LIST_WEIGHT' => SLAVE_LIST_WEIGHT,
                        'PRODUCT_LIST_IMAGE' => SLAVE_LIST_IMAGE,
                        'PRODUCT_SLAVE_BUY_NOW' => SLAVE_LIST_BUY_NOW);

   asort($define_list);

   $column_list = array();
   reset($define_list);
   while (list($key, $value) = each($define_list)) {
     if ($value > 0) $column_list[] = $key;
   }

   $select_column_list = '';

   for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
     switch ($column_list[$i]) {
       case 'PRODUCT_LIST_MODEL':
         $select_column_list .= 'p.products_model, ';
         break;
       case 'PRODUCT_LIST_NAME':
         $select_column_list .= 'pd.products_name, ';
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $select_column_list .= 'm.manufacturers_name, ';
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $select_column_list .= 'p.products_quantity, ';
         break;
       case 'PRODUCT_LIST_IMAGE':
         $select_column_list .= 'p.products_image, ';
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $select_column_list .= 'p.products_weight, ';
         break;
     }
   }

   $listing_sql = "select " . $select_column_list . " p.products_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, pm.master_id, pm.slave_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_MASTER . " pm, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id=pm.slave_id and pm.master_id='" . (int)$HTTP_GET_VARS['products_id'] . "'";

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;
       }
     }
   } else {
     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);
     $listing_sql .= ' order by ';
     switch ($column_list[$sort_col-1]) {
       case 'PRODUCT_LIST_MODEL':
         $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_NAME':
         $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_IMAGE':
         $uni .= "pd.products_name";
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_PRICE':
         $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
     }
   }
$template['filenameproductlisting'] = FILENAME_PRODUCT_LISTING;

//END MASTER PRODUCTS

 

All I got inplace of where the $variable call in the product_info.php.html template was, was the words "product_info.php" instead of the master products contrib.

 

Hopefully this explains the problem a little more.

 

Cheers..

Link to comment
Share on other sites

I think there is something on it about 50 pages back lol This thread is getting waaaay to big..

 

Just make up a html page and call it index.php_"catnumber".html then place it inside you includes/sts_templates/ folder and that's about it.

Hello,

 

I have succesfully edited and changed my 'sts_template.html' page.

The problem comes when I create the folder 'sts_templates' inside 'includes' and place there my file 'product_info.php.html', the changes I did just aren't applied so it still shows the default product page as well as it does when I try to make any categorie page like for example: 'index.php_38.html'...:(

Any idea why?

Thanks in advanced.

Link to comment
Share on other sites

Hello,

 

I have succesfully edited and changed my 'sts_template.html' page.

The problem comes when I create the folder 'sts_templates' inside 'includes' and place there my file 'product_info.php.html', the changes I did just aren't applied so it still shows the default product page as well as it does when I try to make any categorie page like for example:  'index.php_38.html'...:(

Any idea why?

Thanks in advanced.

Did you apply the 25 Aug 2004 - STS 2.01 Bug fixes?

 

If so I found that using that killed my product_info.html pages. This fix with in the sts_display_output.php worked for me http://www.oscommerce.com/forums/index.php?sho...ndpost&p=441854

 

I did that after I applied the 25 Aug 2004 - STS 2.01 Bug fix

 

Good luck with it!

Edited by Vince76
Link to comment
Share on other sites

Someone help please!

 

Hi,

 

Last night I installed fresh os and also installed sts. Now all worked but did not add the latest bug fix.

 

Anyway I opened a template in coffee cup and began to edit it. Seems easy enough but ran into a snag. Forgive me If this has been posted somewhere but the forum is so huge do not have time to read all posts.

 

Anyway, I wanted to add a header picture and I did using the picture slicer. I then wanted to add the $searchbox, or $whatever into the picture.

 

So that way the search box or the languages flags, or the breadcrumb area would be overlayed on the picture. Not sure how to do this?

 

Is there a manual on this or am I going about it the wrong way?

 

I downloaded a book by G Burton from oscbooks.com in this book no sts is used but he describes how to change the look of the site and walks you through it. The way he adds, or overlays the script on the picture is by changing code and adding stylesheet classes  and then slicing a picture and refering to the class="infobox"  someting like that.

 

Just thought with the sts it couls be done easier?

 

Please help!

Link to comment
Share on other sites

Someone help please!

 

Hi,

 

Last night I installed fresh os and also installed sts. Now all worked but did not add the latest bug fix.

 

Anyway I opened a template in coffee cup and began to edit it. Seems easy enough but ran into a snag. Forgive me If this has been posted somewhere but the forum is so huge do not have time to read all posts.

 

Anyway, I wanted to add a header picture and I did using the picture slicer. I then wanted to add the $searchbox, or $whatever into the picture.

 

So that way the search box or the languages flags, or the breadcrumb area would be overlayed on the picture. Not sure how to do this?

 

Is there a manual on this or am I going about it the wrong way?

 

I downloaded a book by G Burton from oscbooks.com in this book no sts is used but he describes how to change the look of the site and walks you through it. The way he adds, or overlays the script on the picture is by changing code and adding stylesheet classes  and then slicing a picture and refering to the class="infobox"  someting like that.

 

Just thought with the sts it couls be done easier?

 

Please help!

Try to design the page as you want it to appear in your HTML editor. No STS tags or anything.

 

After you get the look and feel you want, then start adding tags where wanted, and check them as you go to see if they work.

 

It sounds like you are trying to add a form over an image. You can do this by adding a table with a background graphic specified in CSS or the table itself, or with a div tag with a background (I think, haven't played too much with tableless layouts yet).

 

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

Hi I just installed this and worked out few problems, but when I add a new box in the sts_user_code.php to show in the naviagtion, everthing works fine. But when I click on the enlarge image button for images in the product page, the box I added comes up with the image??? I have no clue why its doing this.

$sts_block_name = 'helpdesk';
require(STS_START_CAPTURE);
   echo "\n<!-- Start Help Desk -->\n";
require(DIR_WS_BOXES . 'helpdesk.php');
   echo "<!-- End Help Desk -->\n";
require(STS_STOP_CAPTURE);
$template['helpdesk'] = strip_unwanted_tags($sts_block['helpdesk'], 'helpdesk');

 

Thats my new box. I did all updates but still no dice? Any suggestions on what I am doing wrong? Thank you.

Link to comment
Share on other sites

Hello everyone,

i am using sts v. 1.3 when i installed it in march of 2004. now this new one is out, how do i migrate from thatversion to this. plz give me the link and let me know if its worth it.

 

i guess i wanna 2 these 2 things for sure.

 

want product name in header.

want another template page to drive one php file.

Link to comment
Share on other sites

hi All, Looked through FAQ and alot of this thread but cant find anything about osCsid..

 

I have been noticing my Session Id's are disapearing and reappeariig with different numbers when i use the templates. For example just going betwee $myaccount and $cartcontents they osCid changes and my basket empties..

 

Anyone haviig this problem or anyone know how to attach $sid to the URls?

 

Thanks

Link to comment
Share on other sites

Now this is really messy I must admit...

 

I tried applying the 25 Aug 2004 - STS 2.01 Bug fixes... and then revert back to the original code as you suggested in your post Vince76... it just didn't work for me... :(

When I access my catalog page I get the initial page which is right but all the other pages just look the same no matter if I delete the 'sts_product_info.php.html' page inside the 'sts_templates'. Can anyone help me out with this? I'll paste below the code for my 'sts_display_output.php' in case I did something wrong without realising with all those changes... Thanks!

 

<?php
/*
$Id: sts_display_output.php,v 1.2 2004/02/05 05:57:12 jhtalk Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

/* 

 Simple Template System (STS) - Copyright (c) 2004 Brian Gallagher - [email protected]

*/

// Used for debugging, please don't change
$sts_version = "2.01";
$sts_osc_version = PROJECT_VERSION;
$sts_osc_version_required = "osCommerce 2.2-MS2";



// Perform OSC version checking
if ($sts_osc_version != $sts_osc_version_required) {
 echo "STS was designed to work with OSC version [$sts_osc_version_required].  This is version [$sts_osc_version].\n";
}

$template['debug'] = $template['debug'].''; // Define as blank if not already defined

/////////////////////////////////////////////
// SELECT HOW TO DISPLAY THE OUTPUT
/////////////////////////////////////////////
$display_template_output = 1;
$display_normal_output = 0;
$display_debugging_output = 0;
$display_version_output = 0;

// Override if we need to show a pop-up window
$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;
}

/////////////////////////////////////////////
// Allow the ability to turn on/off settings from the URL
// Set values to 0 or 1 as needed
/////////////////////////////////////////////

// Allow Template output control from the URL
if ($HTTP_GET_VARS['sts_template'] != "") {
$display_template_output = $HTTP_GET_VARS['sts_template'];
}

// Allow Normal output control from the URL
if ($HTTP_GET_VARS['sts_normal'] != "") {
$display_normal_output = $HTTP_GET_VARS['sts_normal'];
}

// Allow Debugging control from the URL
if ($HTTP_GET_VARS['sts_debug'] != "") {
$display_debugging_output = $HTTP_GET_VARS['sts_debug'];
}

// Allow Version control from the URL
if ($HTTP_GET_VARS['sts_version'] != "") {
$display_version_output = $HTTP_GET_VARS['sts_version'];
}

// Print out version number if needed
if ($display_version_output == 1 or $display_debugging_output == 1) {
print "STS_VERSION=[$sts_version]\n";
print "OSC_VERSION=[$sts_osc_version]\n";
}

// Start with the default template
$sts_template_file = STS_DEFAULT_TEMPLATE;

// See if there is a custom template file for the currently running script
$sts_check_file = STS_TEMPLATE_DIR . $scriptbasename . ".html";
if (file_exists($sts_check_file)) {
 // Use it
 $sts_template_file = $sts_check_file;
} 

// Are we in the index.php script?  If so, what is our Category Path (cPath)?
if ($scriptbasename == "index.php") {
 // If no cPath defined, default to 0 (the home page)
 if ($cPath == "") {
$sts_cpath = 0; 
 } else {
       $sts_cpath = $cPath;
 }

 // Look for category-specific template file like "index.php_1_17.html"
 $sts_check_file = STS_TEMPLATE_DIR . "index.php_$sts_cpath.html";

 if (file_exists($sts_check_file)) {
   // Use it
   $sts_template_file = $sts_check_file;
 } 

}

// Open Template file and read into a variable
if (! file_exists($sts_template_file)) {
 echo "Template file doesn't exist: [$sts_template_file]";
}  else {
 echo "<!-- Using Template File [$sts_template_file) -->\n";
}

if (! $fh = fopen($sts_template_file, 'r')) {
echo "Can't open Template file: [$sts_template_file]";
}

$template_html = fread($fh, filesize($sts_template_file));
fclose($fh);


/////////////////////////////////////////////
////// if product_info.php load data
/////////////////////////////////////////////
if ($scriptbasename == 'product_info.php') {
 require(STS_PRODUCT_INFO);
}

/////////////////////////////////////////////
////// Run any user code needed
/////////////////////////////////////////////
require(STS_USER_CODE);

/////////////////////////////////////////////
////// Set up template variables
/////////////////////////////////////////////

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

/////////////////////////////////////////////
////// Set up template variables
/////////////////////////////////////////////

 $template['sid'] =  tep_session_name() . '=' . tep_session_id();

 // Strip out <title> variable
 $template['title'] = str_between($sts_block['headertags'], "<title>", "</title>");

 // Load up the <head> content that we need to link up everything correctly.  Append to anything that may have been set in sts_user_code.php
$template['headcontent'] = $template['headcontent']. '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">' . "\n"; 
$template['headcontent'] = $template['headcontent']. $sts_block['headertags'];
$template['headcontent'] = $template['headcontent']. '<base href="' . (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . '">' . "\n";
 // $template['headcontent'] = $template['headcontent']. '<link rel="stylesheet" type="text/css" href="stylesheet.css">' . "\n";
$template['headcontent'] = $template['headcontent']. get_javascript($sts_block['applicationtop2header'],'get_javascript(applicationtop2header)');
  

 // Note: These values lifted from the stock /catalog/includes/header.php script's HTML
 // catalogurl: url to catalog's home page
 // catalog: link to catalog's home page
 $template['cataloglogo'] = '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce') . '</a>';
 $template['urlcataloglogo'] = tep_href_link(FILENAME_DEFAULT);

 $template['myaccountlogo'] = '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>';
 $template['urlmyaccountlogo'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');

 $template['cartlogo'] = '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>';
 $template['urlcartlogo'] = tep_href_link(FILENAME_SHOPPING_CART);

 $template['checkoutlogo'] = '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>';
 $template['urlcheckoutlogo'] = tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL');

 $template['breadcrumbs'] = $breadcrumb->trail(' » ');

 if (tep_session_is_registered('customer_id')) {
   $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');
   $template['logoff'] = '<a href=' . tep_href_link(FILENAME_LOGOFF, '', 'SSL')  . ' class="headerNavigation">' . HEADER_TITLE_LOGOFF . '</a>';
   $template['urllogoff'] = tep_href_link(FILENAME_LOGOFF, '', 'SSL');
   $template['myaccountlogoff'] = $template['myaccount'] . " | " . $template['logoff'];
 } 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');
   $template['logoff'] = '';
   $template['urllogoff'] = '';
   $template['myaccountlogoff'] = $template['myaccount'];
 }

 $template['cartcontents']    = '<a href=' . tep_href_link(FILENAME_SHOPPING_CART) . ' class="headerNavigation">' . HEADER_TITLE_CART_CONTENTS . '</a>';
 $template['urlcartcontents'] = '<a href=' . tep_href_link(FILENAME_SHOPPING_CART) . ' class="headerNavigation">' . HEADER_TITLE_CART_CONTENTS . '</a>';

 $template['checkout'] = '<a href=' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . ' class="headerNavigation">' . HEADER_TITLE_CHECKOUT . '</a>';
 $template['urlcheckout'] = tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL');

/////////////////////////////////////////////
////// Create custom boxes
/////////////////////////////////////////////
 $template['categorybox'] = strip_unwanted_tags($sts_block['categorybox'], 'categorybox');
 $template['manufacturerbox'] = strip_unwanted_tags($sts_block['manufacturerbox'], 'manufacturerbox');
 $template['whatsnewbox'] = strip_unwanted_tags($sts_block['whatsnewbox'], 'whatsnewbox');
 $template['searchbox'] = strip_unwanted_tags($sts_block['searchbox'], 'searchbox');
 $template['informationbox'] = strip_unwanted_tags($sts_block['informationbox'], 'informationbox');
 $template['cartbox'] = strip_unwanted_tags($sts_block['cartbox'], 'cartbox');
 $template['maninfobox'] = strip_unwanted_tags($sts_block['maninfobox'], 'maninfobox');
 $template['orderhistorybox'] = strip_unwanted_tags($sts_block['orderhistorybox'], 'orderhistorybox');
 $template['bestsellersbox'] = strip_unwanted_tags($sts_block['bestsellersbox'], 'bestsellersbox');
 $template['specialfriendbox'] = strip_unwanted_tags($sts_block['specialfriendbox'], 'specialfriendbox');
 $template['reviewsbox'] = strip_unwanted_tags($sts_block['reviewsbox'], 'reviewsbox');
 $template['languagebox'] = strip_unwanted_tags($sts_block['languagebox'], 'languagebox');
 $template['currenciesbox'] = strip_unwanted_tags($sts_block['currenciesbox'], 'currenciesbox');
 $template['content'] = strip_content_tags($sts_block['columnleft2columnright'], 'content');
 // Prepend any error/warning messages to $content
 if ($messageStack->size('header') > 0) {
   $template['content'] = $messageStack->output('header') . $template['content'];
 }
 $template['date'] = strftime(DATE_FORMAT_LONG);
 $template['numrequests'] = $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted;
 $template['counter'] = $sts_block['counter'];
 $template['footer'] = $sts_block['footer'];
 $template['banner'] = $sts_block['banner'];

 
/////////////////////////////////////////////
////// Get Categories
/////////////////////////////////////////////
$get_categories_description_query = tep_db_query("SELECT categories_id, categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION);
// Loop through each category (in each language) and create template variables for each name and path
while ($categories_description = tep_db_fetch_array($get_categories_description_query)) {
     $cPath_new = tep_get_path($categories_description['categories_id']);
     $path = substr($cPath_new, 6); // Strip off the "cPath=" from string

     $catname = $categories_description['categories_name'];
     $catname = str_replace(" ", "_", $catname); // Replace Spaces in Category Name with Underscores

     $template["cat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new);
     $template["urlcat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new);
     $template["cat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new);
     $template["urlcat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new);

     // print "<b>template[" . $categories_description['categories_name'] . "]=" . $template[$categories_description['categories_name']] . "<br>template[" . $path . "]=" . $template[$path] . "</b>";
}

/////////////////////////////////////////////
////// Display Template HTML
/////////////////////////////////////////////

 // Sort array by string length, so that longer strings are replaced first
 uksort($template, "sortbykeylength");

 // Manually replace the <!--$headcontent--> if present
   $template_html = str_replace('<!--$headcontent-->', $template['headcontent'], $template_html);

 // Automatically replace all the other template variables
 foreach ($template as $key=>$value) {
   $template_html = str_replace('$' . $key, $value, $template_html);
 }

 if ($display_template_output == 1) {
   echo $template_html;
 }


/////////////////////////////////////////////
////// Display HTML
/////////////////////////////////////////////
if ($display_normal_output == 1) {
 echo $sts_block['applicationtop2header'];
 echo $sts_block['header'];


 echo $sts_block['header2columnleft'];

 // print column_left stuff
 echo $sts_block['categorybox'];
 echo $sts_block['manufacturerbox'];
 echo $sts_block['whatsnewbox'];
 echo $sts_block['searchbox'];
 echo $sts_block['informationbox'];

 echo $sts_block['columnleft2columnright'];

 // print column_right stuff
 echo $sts_block['cartbox'];
 echo $sts_block['maninfobox'];
 echo $sts_block['orderhistorybox'];
 echo $sts_block['bestsellersbox'];
 echo $sts_block['specialfriendbox'];
 echo $sts_block['reviewsbox'];
 echo $sts_block['languagebox'];
 echo $sts_block['currenciesbox'];

 echo $sts_block['columnright2footer'];

 // print footer
 echo $sts_block['content'];
 echo $sts_block['counter'];
 echo $sts_block['footer'];
 echo $sts_block['banner'];
}
/////////////////////////////////////////////
////// End Display HTML
/////////////////////////////////////////////

if ($display_debugging_output == 1) {
 // Print Debugging Info
 print "\n<pre><hr>\n";
 print "STS_VERSION=[" . $sts_version . "]<br>\n";
 print "OSC_VERSION=[$sts_osc_version]\n";
 print "STS_TEMPLATE=[" . $sts_template_file . "]<hr>\n";
 // Replace $variable names in $sts_block_html_* with variables from the $template array
 foreach ($sts_block as $key=>$value) {
   print "<b>\$sts_block['$key']</b><hr>" . htmlspecialchars($value) . "<hr>\n";
 }

 foreach ($template as $key=>$value) {
   print "<b>\$template['$key']</b><hr>" . htmlspecialchars($value) . "<hr>\n";
 }

}

if ($display_normal_output == 1) {
 echo $sts_block['footer2applicationbottom'];
}

// STRIP_UNWANTED_TAGS() - Remove leading and trailing <tr><td> from strings
function strip_unwanted_tags($tmpstr, $commentlabel) {
 // Now lets remove the <tr><td> that the require puts in front of the tableBox
 $tablestart = strpos($tmpstr, "<table");

 // If empty, return nothing
 if ($tablestart < 1) {
	 return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
 }

 $tmpstr = substr($tmpstr, $tablestart); // strip off stuff before <table>

 // Now lets remove the </td></tr> at the end of the tableBox output
 // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
 $tmpstr = strrev($tmpstr);

 $tableend = strpos($tmpstr, strrev("</table>"), 1);
 $tmpstr = substr($tmpstr, $tableend);  // strip off stuff after </table>

 // Now let's un-reverse it
 $tmpstr = strrev($tmpstr);

 // print "<hr>After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[".  htmlspecialchars($tmpstr) . "]<hr>\n";
 return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
}


// STRIP_CONTENT_TAGS() - Remove text before "body_text" and after "body_text_eof"
function strip_content_tags($tmpstr, $commentlabel) {
 // Now lets remove the <tr><td> that the require puts in front of the tableBox
 $tablestart = strpos($tmpstr, "<table");
 $formstart = strpos($tmpstr, "<form");

 // If there is a <form> tag before the <table> tag, keep it
 if ($formstart !== false and $formstart < $tablestart) {
    $tablestart = $formstart;
    $formfirst = true;
 }

 // If empty, return nothing
 if ($tablestart < 1) {
       return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
 }
 
 $tmpstr = substr($tmpstr, $tablestart); // strip off stuff before <table>

 // Now lets remove the </td></tr> at the end of the tableBox output
 // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
 $tmpstr = strrev($tmpstr);

 if ($formfirst == true) {
   $tableend = strpos($tmpstr, strrev("</form>"), 1);
 } else {
   $tableend = strpos($tmpstr, strrev("</table>"), 1);
 } 

 $tmpstr = substr($tmpstr, $tableend);  // strip off stuff after <!-- body_text_eof //-->

 // Now let's un-reverse it
 $tmpstr = strrev($tmpstr);

 // print "<hr>After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[".  htmlspecialchars($tmpstr) . "]<hr>\n";
 return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
}


function get_javascript($tmpstr, $commentlabel) {
 // Now lets remove the <tr><td> that the require puts in front of the tableBox
 $tablestart = strpos($tmpstr, "<script");

 // If empty, return nothing
 if ($tablestart === false) {
	 return  "\n<!-- start $commentlabel //-->\n\n<!-- end $commentlabel //-->\n";
 }

 $tmpstr = substr($tmpstr, $tablestart); // strip off stuff before <table>

 // Now lets remove the </td></tr> at the end of the tableBox output
 // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
 $tmpstr = strrev($tmpstr);

 $tableend = strpos($tmpstr, strrev("</script>"), 1);
 $tmpstr = substr($tmpstr, $tableend);  // strip off stuff after </table>

 // Now let's un-reverse it
 $tmpstr = strrev($tmpstr);

 // print "<hr>After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[".  htmlspecialchars($tmpstr) . "]<hr>\n";
 return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
}

// Return the value between $startstr and $endstr in $tmpstr
function str_between($tmpstr, $startstr, $endstr) {
 $startpos = strpos($tmpstr, $startstr);

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

 $tmpstr = substr($tmpstr, $startpos + strlen($startstr)); // strip off stuff before $start

 // Now lets remove the </td></tr> at the end of the tableBox output
 // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
 $tmpstr = strrev($tmpstr);

 $endpos = strpos($tmpstr, strrev($endstr), 1);

 $tmpstr = substr($tmpstr, $endpos + strlen($endstr));  // strip off stuff after </table>

 // Now let's un-reverse it
 $tmpstr = strrev($tmpstr);

 return  $tmpstr;
}

function sortbykeylength($a,$b) {
 $alen = strlen($a);
 $blen = strlen($b);
 if ($alen == $blen) $r = 0;
 if ($alen < $blen) $r = 1;
 if ($alen > $blen) $r = -1;
 return $r;
}

?>

Link to comment
Share on other sites

Nobody knows how to fix my problem that I've posted about ten times? I find it hard to believe, with as good as you guys/gals are, that you can't find a fix for my problem.

 

JP

Link to comment
Share on other sites

Is this the name of your file in the sts_templates folder "sts_product_info.php.html" ? If it is change it to "product_info.php.html"

Sorry, I mistyped the file name... its name is 'product_info.php.html' and I still have the same error.

The 'sts_template.html' is ok... but the rest of my pages look the same as 'sts_template.html'

 

I'm so desperate that I even tried deleting the complete contribution and installed the 2.0 version... but I have the same error! Is there any specific code that needs to go into the 'sts_template.html' to work properly?

All I did was a 'sts_template.html' page with links to different sections like the reviews, specials, all my categories and the $searchbox... but I want to display another page when someone clicks any of the sections... well I think that's what this contrib. does... I just don't know for what reason it's not working. I'm open to any suggestions...

Link to comment
Share on other sites

I just don't know for what reason it's not working. I'm open to any suggestions...

Right... there is always something left to check...

 

It was the '$content' what wasn't in the correct place... now it's all working fine!

Thanks for your help Vince.

Link to comment
Share on other sites

I just don't know for what reason it's not working. I'm open to any suggestions...

Right... there is always something left to check...

 

It was the '$content' what wasn't in the correct place... now it's all working fine!

Thanks for your help Vince.

Glad it was something simple ;-)

Link to comment
Share on other sites

Hi Brain,

 

I want to put the review direct under the product discription, i try to install the contribution call Reviews in Product Display, it cant display normal in STS.

 

I've two question,

1) I don't know how to make this contrib normal in STS?

2) Did you have other solution for my request??

 

Thank you very much again & again

Link to comment
Share on other sites

Hi Brain,

 

I want to put the review direct under the product discription, i try to install the contribution call  Reviews in Product Display, it cant display normal in STS.

 

I've two question,

1) I don't know how to make this contrib normal in STS?

2) Did you have other solution for my request??

 

Thank you very much again & again

1) You need to copy the code that prints out the reviews into sts_product_info.php and put the require(STS_START_CAPTURE) and require(STS_STOP_CAPTURE) around it, and set the captured text to a template value. Look at how all the other variables are assigned in sts_product_info.php and you should see how to do it.

 

2) I thought I did, but I guess not. Please restate your question with more explanation of what you want to accomplish. (Don't repost the old one, I obviously didn't understand it the first time).

 

- 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

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