Jump to content
DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

I have it working now thanks :) But i have another prob. If anyone can help. first in ordert to get my images to show i had to change all the file paths from images/some.jpg to the full url path ? This may be required but i dunno so threw it in there for troubleshooting purposes.

 

However now when i click a link it goes to ie: http:///shopping_cart.php?osCsid=6b5cd3e328ea3ae43de8bcb437b22f9c&osCsid=6b5cd3e328ea3ae43de8bcb437b22f9c'>http:///shopping_cart.php?osCsid=6b5cd3e328ea3ae43de8bcb437b22f9c&osCsid=6b5cd3e328ea3ae43de8bcb437b22f9c

 

note the http:///shopping_cart.php? part.

 

if anyone has any ideas i would appreciate it as i think this is an awesome cart and a great template system ya have here.

 

 

if ya wanna see the mess i have so far :) My Webpage

Share this post


Link to post
Share on other sites
3) At the bottom of each page, I see the characters "</".

 

Answer: You need to upgrade your server's version of PHP. This was a subtle bug in older versions. Updating your PHP will fix it. You should upgrade it anyway, since if you are running a version with this problem, there are also security fixes that have been added to later versions of PHP that you need to secure your system.

hi brian,

 

which version of php do i have to use to avoid the </ bug at the end of the pages?

 

i'm running php 4.2.3 (Zend: 1.2.0) on my server.

 

thanks in advance!

 

jenson

 

 

see it in action at: Jens' Boutique

Share this post


Link to post
Share on other sites

Has anyone seen any performance issues after installing STS? Seems like things got a whole lot slower after I got STS working. So for kicks I installed a clean copy of OSC and tested...fast. Then I setup STS and my performance went down by half, so it wasn't my original install of STS and OSC that gave me problems. You can look Here or click on the www link below to see my site as it is now.

 

thanks, sparks

Share this post


Link to post
Share on other sites

1. Does it work with HTTPS ?

2. how hard is it to install on a modded version of MS2.2

3. Is it worth the troulbe or should i just edit the HTML my self?

Share this post


Link to post
Share on other sites
Is there really nobody who knows a solution for my problem with the loginbox????????

 

I installed the new Version of STS and everything work fine - but the loginbox does not work. There is only the code $loginbox visible - but not the box.

 

In my old version (1.8) the loginbox works without problems.

 

What can I do?

Look in the sts_display_output.php file and make sure the there is a template setup for the login box. There should be a line that looks something like this:

 

$template['loginbox'] = strip_unwanted_tags($sts_block['loginbox'], 'loginbox');

 

listed with all the other boxes. Usually when all that shows up is the tag $loginbox that means the template is not set up or that the tag does not match what is setup.

Thanks for your help. You are right - the line was not in the file. I added the line and now the word $loginbox is not visible any longer - but the box is also not visible.

Now it is emty. Do you have a further suggestion?

 

Thanks a lot...

Edited by lindstrom

Share this post


Link to post
Share on other sites

Now I tryed to insert the following line in the column_left.php and column_right.php

 

  // BOF: WebMakers Added: Login Box My Account

    require(DIR_WS_BOXES . 'loginbox.php');

// EOF: WebMakers Added: Login Box My Account

 

When I insert the line in column_left.php the box will be visible but in the middle and destroys the whole design.

 

When I insert it in the column_right at the end - nothing happens.

 

May you could find the problem when post my sts_display_output and the column files:

 

So here ist the sts_display_output:

 

<?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 © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

/*

 

  Simple Template System (STS) - Copyright © 2004 Brian Gallagher - brian@diamondsea.com

 

*/

 

// Used for debugging, please don't change

$sts_version = "2.01";

$sts_osc_version = PROJECT_VERSION;

$sts_osc_version_required = "osCommerce 2.2-MS2";

 

echo "<!-- Page layout by Simple Template System (STS) v$sts_version on $sts_osc_version - http://www.diamondsea.com/sts/ -->\n";

 

// 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'] .= ''; // 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'] .= '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">' . "\n";

  $template['headcontent'] .= $sts_block['headertags'];

  $template['headcontent'] .= '<base href="' . (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . '">' . "\n";

  // $template['headcontent'] .= '<link rel="stylesheet" type="text/css" href="stylesheet.css">' . "\n";

  $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');

  $template['loginbox'] = strip_unwanted_tags($sts_block['loginbox'], 'loginbox');

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

}

 

?>

 

 

 

Here is my column_left:

 

<?php

/*

  $Id: column_left.php,v 1.15 2003/07/01 14:34:54 hpdl Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2003 osCommerce

 

  Released under the GNU General Public License

*/

  // STS: ADD

  $sts_block_name = 'header2columnleft';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  if ((USE_CACHE == 'true') && empty($SID)) {

    echo tep_cache_categories_box();

  } else {

    include(DIR_WS_BOXES . 'categories.php');

  }

 

  // STS: ADD

  $sts_block_name = 'categorybox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  if ((USE_CACHE == 'true') && empty($SID)) {

    echo tep_cache_manufacturers_box();

  } else {

    include(DIR_WS_BOXES . 'manufacturers.php');

  }

 

  // STS: ADD

  $sts_block_name = 'manufacturerbox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  require(DIR_WS_BOXES . 'whats_new.php');

 

  // STS: ADD

  $sts_block_name = 'whatsnewbox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  require(DIR_WS_BOXES . 'search.php');

 

  // STS: ADD

  $sts_block_name = 'searchbox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  require(DIR_WS_BOXES . 'information.php');

 

  // STS: ADD

  $sts_block_name = 'informationbox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  require(DIR_WS_BOXES . 'shopping_cart.php');

 

  // STS: ADD

  $sts_block_name = 'cartbox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  if (isset($HTTP_GET_VARS['products_id'])) include(DIR_WS_BOXES . 'manufacturer_info.php');

 

  // STS: ADD

  $sts_block_name = 'maninfobox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  if (tep_session_is_registered('customer_id')) include(DIR_WS_BOXES . 'order_history.php');

 

  // STS: ADD

  $sts_block_name = 'orderhistorybox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  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');

  }

 

  // STS: ADD

  $sts_block_name = 'bestsellersbox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

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

    if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');

  } else {

    include(DIR_WS_BOXES . 'specials.php');

  }

 

  // STS: ADD

  $sts_block_name = 'specialfriendbox';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

 

  if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {

    include(DIR_WS_BOXES . 'languages.php');

 

    // STS: ADD

    $sts_block_name = 'languagebox';

    require(STS_RESTART_CAPTURE);

    // STS: EOADD

 

    include(DIR_WS_BOXES . 'currencies.php');

 

    // STS: ADD

    $sts_block_name = 'currenciesbox';

    require(STS_RESTART_CAPTURE);

    // STS: EOADD

 

  }

 

?>

 

 

And the column_right:

 

 

<?php

/*

  $Id: column_right.php,v 1.17 2003/06/09 22:06:41 hpdl Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2003 osCommerce

 

  Released under the GNU General Public License

*/

 

  // STS: ADD

  $sts_block_name = 'columnleft2columnright';

  require(STS_RESTART_CAPTURE);

  // STS: EOADD

   

  require(DIR_WS_BOXES . 'reviews.php');

 

  // STS: ADD

  $sts_block_name = 'reviewsbox';

  require(STS_RESTART_CAPTURE);

 

?>

 

 

I hope you could find the error. Thanks for your time.

Share this post


Link to post
Share on other sites

Add this to your sts_display_output file under print column left stuff

 

echo $sts_block['loginbox'];

 

In your column_left.php file look for this

 

require(DIR_WS_BOXES . 'information.php');

 

// STS: ADD

$sts_block_name = 'informationbox';

require(STS_RESTART_CAPTURE);

// STS: EOADD

 

and add this below it for you login box

 

 

require(DIR_WS_BOXES . 'loginbox.php');

 

// STS: ADD

$sts_block_name = 'loginbox';

require(STS_RESTART_CAPTURE);

// STS: EOADD

 

I am pretty sure that is everything I added to make it work.


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

Share this post


Link to post
Share on other sites

I'm getting this error after installing sts over my new store

 

Warning: main(includes/sts_user_code.php): failed to open stream: No such file or directory in /home/king/public_html/practice/includes/sts_display_output.php on line 138

Fatal error: main(): Failed opening required 'includes/sts_user_code.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/king/public_html/practice/includes/sts_display_output.php on line 138

Share this post


Link to post
Share on other sites

Sorry can't help yopu above but I have a quick question.

 

Is there a DHTML categories menu contrib that works with STS? I tried one but could not get it to work.

 

thanks :rolleyes:

Share this post


Link to post
Share on other sites
I'm getting this error after installing sts over my new store

 

Warning: main(includes/sts_user_code.php): failed to open stream: No such file or directory in /home/king/public_html/practice/includes/sts_display_output.php on line 138

Fatal error: main(): Failed opening required 'includes/sts_user_code.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/king/public_html/practice/includes/sts_display_output.php on line 138

Not 100% certain but it seems that I received that or a similar error message when I failed to make the needed changes to the configure.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??

Share this post


Link to post
Share on other sites

The STS thread has been edited to comply with forum rules (AMAP) - please try to keep it that way.

 

Questions/comments regarding this may be pm'd to Team Members, not posted here (offtopic).

 

Thankyou,

 

Matti

osCommerce Team Member


Matti Ressler

 

We were all once expert at...... nothing

_____

Share this post


Link to post
Share on other sites

Dear Richard,

 

Thank you very much. Your reply was very helpful. Now everything works fine.

 

Best regards,

 

Lars

Share this post


Link to post
Share on other sites
I'm getting this error after installing sts over my new store

 

Warning: main(includes/sts_user_code.php): failed to open stream: No such file or directory in /home/king/public_html/practice/includes/sts_display_output.php on line 138

Fatal error: main(): Failed opening required 'includes/sts_user_code.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/king/public_html/practice/includes/sts_display_output.php on line 138

Not 100% certain but it seems that I received that or a similar error message when I failed to make the needed changes to the configure.php file.

This is what I added to the configure.php

 

// STS: ADD: Define Simple Template System files
 define('STS_START_CAPTURE', DIR_WS_INCLUDES . 'sts_start_capture.php');
 define('STS_STOP_CAPTURE', DIR_WS_INCLUDES . 'sts_stop_capture.php'); 
 define('STS_RESTART_CAPTURE', DIR_WS_INCLUDES . 'sts_restart_capture.php');
 define('STS_TEMPLATE_DIR', DIR_WS_INCLUDES . 'sts_templates/');
 define('STS_DEFAULT_TEMPLATE', DIR_WS_INCLUDES . 'sts_template.html'); 
 define('STS_DISPLAY_OUTPUT', DIR_WS_INCLUDES . 'sts_display_output.php');
 define('STS_USER_CODE', DIR_WS_INCLUDES . 'sts_user_code.php');
 define('STS_PRODUCT_INFO', DIR_WS_INCLUDES . 'sts_product_info.php');
// STS: EOADD

 

Any clue on how to fix it? Do I need to change something else in there?

Share this post


Link to post
Share on other sites

I figured it out. It was a bad install. I just deleted the installation and re-installed everything and it worked perfectly. Thanks for responding though Richard. I appreciate it.

Share this post


Link to post
Share on other sites

Dear STS members,

 

I'm really frustrated because I can't seem to find a payment gateway that works with STS. For some reason STS messes up cURL calls. If we can't hook up to a payment gateway, then what's the point of even using this contribution??! There must be someone out there that is using STS fully and selling things too. What are you using to process credit cards?

 

Please help me! Please!

Share this post


Link to post
Share on other sites
Dear STS members,

 

I'm really frustrated because I can't seem to find a payment gateway that works with STS.  For some reason STS messes up cURL calls.  If we can't hook up to a payment gateway, then what's the point of even using this contribution??!  There must be someone out there that is using STS fully and selling things too.  What are you using to process credit cards?

 

Please help me! Please!

This is the first store I have used STS on, so I have only tested it with one gateway. I am successfully using Authorize.net with the Authorize.net Consolidated v.1.7 for AIM contribution.


while (!succeed) {try()};

 

GMT -6:00

Share this post


Link to post
Share on other sites

Hey TomThumb thanks. I tried Authorize.net consolidated for AIM, but it didn't work. Are you using the latest version of STS? Do the error messages from Auhorize display properly. Now that I know it can work, I'll just have to keep debugging it. Perhaps I'll start my store from scratch again to see if that solves the problem. Thanks again.

 

Does anyone else have any other options for payment gateways that work with STS? Thanks everyone.

Share this post


Link to post
Share on other sites
1. Does it work with HTTPS ?

2. how hard is it to install on a modded version of MS2.2

3. Is it worth the troulbe or should i just edit the HTML my self?

1. Yes

2. It depends on how well the contributions adhere to the OSC coding standards for how they present their HTML. STS expects the pages generated to be in a particular format and you may have problems if the format a contribution uses is different.

3. I personally think it is worth the trouble, as you can create a custom look with any HTML editor instead of modifying all the PHP files directly. But I may be biased. ;)

 

- 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

Simple Template System (STS) Public Announcement:

 

If you are installing STS, do not use the installation instructions in the first post of this thread. That was from eight versions ago.

 

There is a README.txt file in the contribution that contains the latest installation information for that version.

 

There is also a file called CHANGELOG.txt present that lists what has been changed in each version, and (sometimes) what you need to do to upgrade from the last version to the next one.

 

Hopefully this will help a couple people in the future....

 

Thanks,

 

- Brian G.

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

Share this post


Link to post
Share on other sites

Hi Brian & everyone

Can you check this out for me to see where I can fix this problem in STS

 

DVBHardware.com

 

Click on Affiliate login User "test@test.com" password "testtest"

 

click on a question mark.

 

I seem to be pulling up the wrong page with the sts it should be predefined information on the topic already setup in the osaffiliate. I have the same problem in the admin section because it is bringing the information from the catalog through the stst.

 

I should be poping up a new window with something like this

 

"Impressions: displays the total number of times a banner or link has been displayed in the given time period." inside

 

I have only a little cosmetic work then I am done.

 

Jimmy


I'm not a coder just a splicer.

Share this post


Link to post
Share on other sites
The  links that STS put on my site arent really following the stylescript the table is giving them (see 'My Account' towards the top of my page: http://www.designimportsinc.com/catalog). Is there a way to force font colors to the STS links?

The My Account variable gets the style "headerNavigation" from the base OSC code. Here's the HTML it is putting in:

 

<a href=https://securehost59.hrwebservices.net/~designi/catalog/account.php?osCsid=2d3bb8a27d6918cfa6c35c8bc29c4346 class="headerNavigation">My Account</a>

 

Try changing your definition for this style (it's in OSC's stylesheet).

 

- 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
The links that STS put on my site arent really following the stylescript the table is giving them (see 'My Account' towards the top of my page: http://www.designimportsinc.com/catalog). Is there a way to force font colors to the STS links?

I looked at the source for the page and you seem to have forced the other links in that bar to white

 

<a href="http://www.designimportsinc.com/services.html"><font color="#FFFFFF">Services</font></a>

 

but the my account is following the style sheet because that is missing and you have a class in there instead

 

<a href=https://securehost59.hrwebservices.net/~designi/catalog/account.php?osCsid=06d6840a9b2109d942fc185ff21ef96d class="headerNavigation">My Account</a>

 

That seems to be why the my account is different.


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

Share this post


Link to post
Share on other sites
The  links that STS put on my site arent really following the stylescript the table is giving them (see 'My Account' towards the top of my page: http://www.designimportsinc.com/catalog). Is there a way to force font colors to the STS links?

The My Account variable gets the style "headerNavigation" from the base OSC code. Here's the HTML it is putting in:

 

<a href=https://securehost59.hrwebservices.net/~designi/catalog/account.php?osCsid=2d3bb8a27d6918cfa6c35c8bc29c4346 class="headerNavigation">My Account</a>

 

Try changing your definition for this style (it's in OSC's stylesheet).

 

- Brian

If you want to eliminate the OSC style, try something like this:

 

<a href="$urlmyaccount">My Account</a>

 

- 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
-Header Logo.  I can't seem to change it.  I went into the header.php file to change it, but it still shows the oscommerce.gif logo.  I changed the display option in sts_display_output.php to debug mode, and it lists the .GIF image that I want.  But even with that, I'm still not seeing my image, only the oscommerce.gif image

I'm having the same problem, except that I edited the sts_display_output.php file to insert my logo. I couldn't find any other file to put it in; that file was my best guess after looking through all of the files. Works fine in template output mode, but the image doesn't display (and isn't in the page source) in normal output mode.

 

1) How do I fix this so that my catalog logo displays in normal output mode?

2) What file should I be editing to define what certain values, such as $cataloglogo, should be? This is perplexing me HUGE, but I can't figure it out.

 

Thanks!

 

Matt

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

×