Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 9 votes

[contribution] Simple Template System (sts)


5806 replies to this topic

#21 DiamondSea

  • Community Member
  • 267 posts
  • Real Name:Brian Gallagher
  • Location:Baltimore, MD

Posted 17 September 2003, 13:59

alliance, on Sep 17 2003, 06:14 AM, said:

Hi all, this contribute is fantastic, but i do not understand how to change the box layout.
Can anyone help me, tnx all
You can't change the box layout with STS. You'd have to change the stylesheet and/or the PHP script that creates the boxes depending on what you want to change.

- 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

#22 jajayao

  • Community Member
  • 3 posts
  • Real Name:james

Posted 17 September 2003, 14:40

great contrib! however, I can't seem to locate the
$display_template_output = 1;
$display_normal_output = 0;
$display_debugging_output = 0;

in the application_bottom.php file? Am I missing something? I have version 1.4 installed.

THanks

#23 DiamondSea

  • Community Member
  • 267 posts
  • Real Name:Brian Gallagher
  • Location:Baltimore, MD

Posted 17 September 2003, 16:25

jajayao, on Sep 17 2003, 09:40 AM, said:

great contrib!  however, I can't seem to locate the
$display_template_output = 1;
  $display_normal_output = 0;
  $display_debugging_output = 0;

in the application_bottom.php file?  Am I missing something?  I have version 1.4 installed.

THanks
It is located near the top of sts_display_output.php.

You can also control it from your browser by adding &STS_DEBUG=1 to turn on the debugging or other options (see the README.txt file in the contribution).

- 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

#24 SevenD

  • Community Member
  • 15 posts
  • Real Name:Goran
  • Location:Croatia > Zagreb > 7dana.com

Posted 17 September 2003, 19:29

Thank you Brian, great contribution.

You can see STS 1.4 implementation in action on my demo site.
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
(\__/)
(O.o )
(> < )

#25 DiamondSea

  • Community Member
  • 267 posts
  • Real Name:Brian Gallagher
  • Location:Baltimore, MD

Posted 17 September 2003, 20:45

SevenD, on Sep 17 2003, 02:29 PM, said:

Thank you Brian, great contribution.

You can see STS 1.4 implementation in action on my demo site.
Your Welcome! Your site looks great!

Can you post a link to your Template.html file so people can see how you set it up?

- 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

#26 SevenD

  • Community Member
  • 15 posts
  • Real Name:Goran
  • Location:Croatia &gt; Zagreb &gt; 7dana.com

Posted 17 September 2003, 22:50

This is one example of sts_template.html (without right column). prewiew
Change the style.css for custom look.

Quote

<html>
<head>
<!--$headcontent-->
</head>
<body>
<table class="okvir" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr class="header">
    <td>$cataloglogo</td>
        </tr>
      </table>     
      <table width="100%" border="0" cellpadding="2" cellspacing="0">
        <tr class="header">
          <td><div align="left">&nbsp;$date&nbsp;</div></td>
          <td><div align="right">$myaccount | $cartcontents | $checkout&nbsp;</div></td>
        </tr>
      </table>     
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td class="headerNavigation">$breadcrumbs</td>
        </tr>
      </table>
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td class="lijevo" rowspan="2" valign="top"> <p>$searchbox$categorybox
              <br>
              $currenciesbox$languagebox $cartbox $orderhistorybox $informationbox<br>
              <img src="images/160.gif"> </p>
            </td>
          <td class="sadrzaj" height="216" colspan="2" valign="top"> <br>
            $content</td>
          <td class="desno" rowspan="2" valign="top"> </td>
        </tr>
        <tr>
          <td width="50%" valign="top">&nbsp;</td>
          <td width="50%" valign="top">$maninfobox</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table width="758"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td><div align="center">$footer</div></td>
        </tr>
      </table>
<table width="758" border="0" align="center" cellpadding="3" cellspacing="0">
  <tr>
    <td><div align="center">$banner</div></td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>
design wiew
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
(\__/)
(O.o )
(> < )

#27 Cat_a_log

  • Community Member
  • 2 posts
  • Real Name:Alessandro

Posted 19 September 2003, 09:19

Hallo, i've a problem with STS that i can't resolve...
The page that is generated with STS has an error in the header information, i show you the code:

---------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Name of My site</title>
<base href="http://www.mysite.com">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

<!-- start get_javascript(applicationtop2header) //-->
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="it">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Name of My site</title>
<base href="http://www.mysite.com">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
---------------------------------------------------------

You can see that the tags <head>, <title> and <html> are repeated. :(
Where is my error?
Thanks for your help.

#28 DiamondSea

  • Community Member
  • 267 posts
  • Real Name:Brian Gallagher
  • Location:Baltimore, MD

Posted 19 September 2003, 14:56

Cat_a_log, on Sep 19 2003, 04:19 AM, said:

Hallo, i've a problem with STS that i can't resolve...
The page that is generated with STS has an error in the header information, i show you the code:

---------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Name of My site</title>
<base href="http://www.mysite.com">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

<!-- start get_javascript(applicationtop2header) //-->
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="it">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Name of My site</title>
<base href="http://www.mysite.com">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
---------------------------------------------------------

You can see that the tags <head>, <title> and <html> are repeated. :(
Where is my error?
Thanks for your help.
What version of STS are you using?

Upgrade to STS v1.4 and it should fix this problem.

- 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

#29 DiamondSea

  • Community Member
  • 267 posts
  • Real Name:Brian Gallagher
  • Location:Baltimore, MD

Posted 19 September 2003, 15:03

You can also update this function to fix the problem with your current version:

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$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("</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";
}

But it's better to just upgrade.

-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

#30 SevenD

  • Community Member
  • 15 posts
  • Real Name:Goran
  • Location:Croatia &gt; Zagreb &gt; 7dana.com

Posted 19 September 2003, 15:39

Quote

You can also update this function to fix the problem with your current version:

Which file need to edit?
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
(\__/)
(O.o )
(> < )

#31 DiamondSea

  • Community Member
  • 267 posts
  • Real Name:Brian Gallagher
  • Location:Baltimore, MD

Posted 19 September 2003, 18:20

SevenD, on Sep 19 2003, 10:39 AM, said:

Quote

You can also update this function to fix the problem with your current version:

Which file need to edit?
It's in application_bottom.php in v1.2, and in sts_display_output.php in v1.3+
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

#32 mocara

  • Community Member
  • 53 posts
  • Real Name:Dave List
  • Location:London, UK

Posted 19 September 2003, 22:22

Anyone out there got a site running this Contrib? It would be nice to see it in action.

#33 j0ker

  • Community Member
  • 652 posts
  • Real Name:Elwyn
  • Location:In front of my PC

Posted 20 September 2003, 08:19

I have a test site I am playing with using sts1.3, and I am running quite a lot of other contribs including STS on this site.
:D
testing
Plz note that the css is all over the place and I hope to sort today, this has nothing to do with the sts.
I also have version 1.4 running on another site under test at Testing another :D

If its speeding the construction of your site that interests you, sts is what you need and it works great.
j0ker
Always seeking & Desperate to find a solution!

#34 DiamondSea

  • Community Member
  • 267 posts
  • Real Name:Brian Gallagher
  • Location:Baltimore, MD

Posted 20 September 2003, 12:43

j0ker, on Sep 20 2003, 03:19 AM, said:

I have a test site I am playing with using sts1.3, and I am running quite a lot of other contribs including STS on this site.
:D
testing
Plz note that the css is all over the place and I hope to sort today, this has nothing to do with the sts.
I also have version 1.4 running on another site under test at Testing another :D

If its speeding the construction of your site that interests you, sts is what you need and it works great.
j0ker
You can see the templates for the above sites here:

http://www.firstbyte.biz/pink/catalog/includes/template.html

http://firstbyte.biz/catalog/includes/sts_template.html

One trick you can use to make debugging the templates easier is to make your image and stylesheet links absolute URL's (with a leading slash or http://) instead of relative (no leading slash).

This will allow you to simply view the template page in your browser exactly as it will appear on your site, as opposed to the missing-image version you get with relative URL's, above.

Just a tip!

- 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

#35 j0ker

  • Community Member
  • 652 posts
  • Real Name:Elwyn
  • Location:In front of my PC

Posted 20 September 2003, 13:01

Thx for the reply,

Nice tip that, I seem to think some ref to that tip in your original docs, but being new to osc and php and keen to get goin I didnt read the docs. :(

I can see a lot in the contrib though as it helps newbies like me to alter osc to look better than the default solution supplied.

Keep up the very good work, I look forward to the next version.

If you need any help testing versions plz dont hesitate to contact me as I am able to bang up a new osc at a moments notice for testing.

Regards
Elwyn
Always seeking & Desperate to find a solution!

#36 Vaiso

  • Community Member
  • 52 posts
  • Real Name:Geoff Cox

Posted 21 September 2003, 11:40

I have just downloaded V1.4 and uploaded the appropriate files and attribed them to 777 just to be sure. I also update the configure.php file as requested.
When I try to load the shop (222.vaiso.com/catalog) I get returned to the OSCommerce installation/upgrade screen. I went through the process of entering my config details again and tried to access the shop.
I get the error shown belo. Can anyone please help :-

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

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

#37 j0ker

  • Community Member
  • 652 posts
  • Real Name:Elwyn
  • Location:In front of my PC

Posted 21 September 2003, 11:48

If this is lioke a new install you must delete the upgrade file or rename it? maybe.

The configure.php did you replace it completely or did you mode it to reflect your shop settings?

More info plz, but if you have replaced the config completely try reverting back to a backup configure file and manually editing the configure.php file with the sts lines of code.. :D
Always seeking & Desperate to find a solution!

#38 Vaiso

  • Community Member
  • 52 posts
  • Real Name:Geoff Cox

Posted 21 September 2003, 17:41

The first time I think I edited the original configure.php file with the required code instead of the one on the server.
I have now reinstalled OSCommerce completely and even before running the install process I have copied the STS (V1.4) files over and edited the configure.php file.
When I run the install process all is fine but I receive the error below when trying to access the shop.
I notice there is a configure.php file in catalog/admin/includes as well as catalog/includes. Does the admin version need to have the STS files also?

ERROR MESSAGE RECEIVED
Warning: main(STS_START_CAPTURE): failed to open stream: No such file or directory in /home/vaisoco/public_html/catalog/includes/application_top.php on line 511

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

#39 j0ker

  • Community Member
  • 652 posts
  • Real Name:Elwyn
  • Location:In front of my PC

Posted 21 September 2003, 17:49

Have you uploaded this file which was missing out of the first release of the 1.4 version?

sts_display_output.php

If so you confirm that you have edited the code, in includes/configure.php you do not need to edit any further config files in admin.

Just a little question, do you have a link for me to see the error or are you running your osc local on a pc?



:rolleyes:
Always seeking & Desperate to find a solution!

#40 Vaiso

  • Community Member
  • 52 posts
  • Real Name:Geoff Cox

Posted 21 September 2003, 18:03

The file sts_display_output.php was present in my V1.4 download and has been uploaded with the other files.
You can view the error at www.vaiso.com/catalog

Just to be sure I have copied the last lines of my configure.php file for you to see.
I am terribly sorry for wasting your time on such a trivial issue.

// define our database connection
define('DB_SERVER', ''); // eg, localhost - should not be empty for productive servers
define('DB_SERVER_USERNAME', '');
define('DB_SERVER_PASSWORD', '');
define('DB_DATABASE', 'osCommerce');
define('USE_PCONNECT', 'false'); // use persistent connections?
define('STORE_SESSIONS', ''); // 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_WS_INCLUDES . 'sts_template.html');
define('STS_DISPLAY_OUTPUT', DIR_WS_INCLUDES . 'sts_display_output.php');
// STS: EOADD
?>