Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Loaded STS V3.0 and now getting errors on index.php page...PLEASE HELP!


Recommended Posts

Posted

I have been working on a site for a little while now and decided that I definitely didn't want the stock OSC layout. So I looked into the STS contribution and decided to go that way. I followed the install instructions and now when you go to my site, all I get is the below errors:

 

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

Warning: fread(): supplied argument is not a valid stream resource in /home/www/sommartimemarketplace/includes/sts_display_output.php on line 178

 

Warning: fclose(): supplied argument is not a valid stream resource in /home/www/sommartimemarketplace/includes/sts_display_output.php on line 179

 

Fatal error: main(): Failed opening required '' (include_path='.:/usr/local/php/share/pear') in /home/www/sommartimemarketplace/includes/sts_display_output.php on line 198

 

My brain is getting fried on fixing things now and I am at a loss. The only other contribution I had before installing this one was the Header Tags Controller. Can someone let me know a possible fix!?

 

Here is the code in the sts_display_output.php file:

<?php

/*

$Id: sts_display_output.php,v 1.1 2005/07/25 18:19:27 stsdsea 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 - [email protected]

 

*/

 

// Used for debugging, please don't change

$sts_version = "3.00 Beta 2";

$sts_osc_version = PROJECT_VERSION;

$sts_osc_version_required = "osCommerce 2.2-MS2";

 

// Set $templatedir and $templatepath (aliases) to current template path on web server, allowing for HTTP/HTTPS differences, removing the trailing slash

$template['templatedir'] = substr(((($request_type == 'SSL') ? DIR_WS_HTTPS_CATALOG : DIR_WS_HTTP_CATALOG) . STS_TEMPLATE_DIR),0,-1);

$template['templatepath'] = $template['templatedir'];

 

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]<br>\n";

print "OSC_VERSION=[$sts_osc_version]<br>\n";

}

 

/////////////////////////////////////////////

////// if product_info.php load data

/////////////////////////////////////////////

if ($scriptbasename == 'product_info.php') {

require(STS_PRODUCT_INFO);

}

 

/////////////////////////////////////////////

///// Determine which template file to use

/////////////////////////////////////////////

$sts_template_array = array(

STS_DEFAULT_TEMPLATE,

STS_TEMPLATE_DIR . $scriptbasename . ".html",

);

 

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

}

 

// If we are doing a search by manufacturer, use the "index.php_mfr.html" template

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

$sts_cpath = "mfr";

}

 

// Split cPath into parts and check for them individually

$cpath_parts = (split("_", $sts_cpath));

foreach ($cpath_parts as $a) {

array_push($sts_template_array, STS_TEMPLATE_DIR . "index.php_$a.html");

}

 

// Look for category-path-specific template file like "index.php_1_17.html"

array_push($sts_template_array, STS_TEMPLATE_DIR . "index.php_$sts_cpath.html");

 

// Check for manufacturer-specific templates

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

array_push($sts_template_array, STS_TEMPLATE_DIR . "index.php_mfr_" . $HTTP_GET_VARS['manufacturers_id'] . ".html");

}

 

 

}

 

// Check for Product_Info templates by Product ID and cPath

if ($scriptbasename == "product_info.php") {

$cpath_parts = (split("_", $cPath));

foreach ($cpath_parts as $a) {

array_push($sts_template_array, STS_TEMPLATE_DIR . "product_info.php_c$a.html");

}

array_push($sts_template_array, STS_TEMPLATE_DIR . "product_info.php_c$cPath.html");

array_push($sts_template_array, STS_TEMPLATE_DIR . "product_info.php_${template['productid']}.html");

}

 

// Select the highest-order template to use

foreach ($sts_template_array as $checkfile) {

if ($display_debugging_output) {

print "Checking for Template: $checkfile -> " . (file_exists($checkfile) ? "Found":"Not Found") . "<br>\n";

}

 

if (file_exists($checkfile)) {

$sts_template_file = $checkfile;

}

}

 

// Active template is now in $sts_template_file

if ($display_debugging_output) {

print "Active Template is [$sts_template_file]<br>\n";

}

 

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

}

 

// Used to read and check for $url_ and $urlcat_ variables

$sts_read_template_file = 1;

// Used for including and executing inline PHP and displaying HTML

$sts_include_template_file = 1;

 

// Old method of reading in html file

if ($sts_read_template_file) {

if (! $fh = fopen($sts_template_file, 'r')) {

echo "Can't open Template file: [$sts_template_file]";

}

 

$sts_template_file_contents = fread($fh, filesize($sts_template_file));

fclose($fh);

}

 

// See if there are any $url_ or $urlcat_ variables in the template file, if so, flag to read them

if (strpos($sts_template_file_contents, "\$url_") or strpos($sts_template_file_contents, "\$urlcat_") ) {

$sts_need_url_tags = 1;

} else {

$sts_need_url_tags = 0;

}

 

 

// new method of including template file as executable code and capturing the output

if ($sts_include_template_file) {

require(STS_START_CAPTURE);

// require("phptest.php");

// print "require($sts_template_file);";

 

// We could just eval($sts_template_file_contents) instead, but we would then lose the optimization

// benefits that a PHP accellerator would offer in caching the compiled code, so we require() the file instead

require($sts_template_file);

$sts_block_name = 'template_html';

require(STS_STOP_CAPTURE);

$template_html = $sts_block['template_html'];

}

 

 

/////////////////////////////////////////////

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

$template['sysmsgs'] = $messageStack->output('header');

 

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

// Prevent page caching

$template['headcontent'] .= '<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"><META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"><META HTTP-EQUIV="Expires" CONTENT="-1">';

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

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

/////////////////////////////////////////////

 

if ($sts_need_url_tags) {

print "<!-- STS: Reading $url_ and $urlcat_ tags, recommend not using them -->";

$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]<br>\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;

}

 

?>

Posted

Would you confirm you've done this step?

 

Add these lines to your /catalog/includes/configure.php script. These lines

should go before the final line with the ?> characters on it.

 

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

 

NOTE: DO NOT put the files in the /admin/ directories. This contribution

only works in the /catalog/ section.

 

Iggy

Everything's funny but nothing's a joke...

Posted
Would you confirm you've done this step?

Iggy

 

Here is my configure.php file in the catalog/includes directory:

<?php
/*
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
 define('HTTP_SERVER', 'http://www.sommartimemarketplace.com'); // eg, http://localhost - should not be empty for productive servers
 define('HTTPS_SERVER', ''); // eg, https://localhost - should not be empty for productive servers
 define('ENABLE_SSL', false); // secure webserver for checkout procedure?
 define('HTTP_COOKIE_DOMAIN', 'www.sommartimemarketplace.com');
 define('HTTPS_COOKIE_DOMAIN', '');
 define('HTTP_COOKIE_PATH', '/');
 define('HTTPS_COOKIE_PATH', '');
 define('DIR_WS_HTTP_CATALOG', '/');
 define('DIR_WS_HTTPS_CATALOG', '');
 define('DIR_WS_IMAGES', 'images/');
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', '/www/sommartimemarketplace/');
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
 define('DB_SERVER', 'mysql.sommartimemarketplace.com'); // eg, localhost - should not be empty for productive servers
 define('DB_SERVER_USERNAME', 'sommartime');
 define('DB_SERVER_PASSWORD', 'sommar69');
 define('DB_DATABASE', 'sommartime');
 define('USE_PCONNECT', 'false'); // use persistent connections?
 define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'
// 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
?>

 

Thanks for the reply...I need all the help I can get! :P

Posted

I am not sure, but there could be a really simple answer.

 

STS 3 looks for sts_templates in a directory /includes/sts_templates/osc/

 

The instructions however suggest they should be found in under includes/sts_templates because the instructions never got updated form V2 to V3

 

Try changing config.php so it says

 

define('STS_TEMPLATE_DIR', DIR_WS_INCLUDES . 'sts_templates/osc/');

 

Charlie

Posted
I am not sure, but there could be a really simple answer.

 

STS 3 looks for sts_templates in a directory /includes/sts_templates/osc/

 

The instructions however suggest they should be found in under includes/sts_templates because the instructions never got updated form V2 to V3

 

Try changing config.php so it says

 

define('STS_TEMPLATE_DIR', DIR_WS_INCLUDES . 'sts_templates/osc/');

 

Charlie

 

After taking a break and then reading your suggestion...I looked back at my /includes/ directory and there was no /sts_templates/osc/ directory there! Added this directory with the sts_templates.html file and all is well! :thumbsup: Thank you for opening my eyes to the obvious! Bravo!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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