Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Simple Template System (sts)


DiamondSea

Recommended Posts

Just as an experiment, I installed v4.5.4. The problem that we are seeing does not manifest itself there. This is just a shot in the dark, but I could there be a problem with the strip_unwanted_tags() function?

 

james

 

I was using v4.5.4 with out a problem.

Link to comment
Share on other sites

With INFOBOX Template Off:

<!-- start categorybox //-->

<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
   <td height="14" class="infoBoxHeading"><img src="images/infobox/corner_left.gif" border="0" alt="" width="11" height="14"></td>
   <td width="100%" height="14" class="infoBoxHeading">Categories</td>
   <td height="14" class="infoBoxHeading" nowrap><img src="images/pixel_trans.gif" border="0" alt="" width="11" height="14"></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
 <tr>

   <td><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
 <tr>
   <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>
 </tr>

 

With INFOBOX Template On:

 

<!-- start categorybox //-->
<img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>
 </tr>

 

Can anyone point me to where I can fix this problem?

Edited by soldsep
Link to comment
Share on other sites

Can anyone point me to where I can fix this problem?

 

I think a typo in the code may be in the catalog/includes/functions/sts.php around line 20.

 

Version 4.5.4 has this:

  $tablestart = strpos($tmpstr, "<td>");

Version 4.5.5 has this:

  $tablestart = strpos($tmpstr, "<td"); // v4.5.5

It should be as 4.5.4.

 

Try it and see if it corrects your table problems when using infobox templates. I just gave this a quick glance and have not tested so please provide feedback to this thread with your results. :thumbsup:

 

Thanks,

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

I think a typo in the code may be in the catalog/includes/functions/sts.php around line 20.

 

Version 4.5.4 has this:

  $tablestart = strpos($tmpstr, "<td>");

Version 4.5.5 has this:

  $tablestart = strpos($tmpstr, "<td"); // v4.5.5

It should be as 4.5.4.

 

Try it and see if it corrects your table problems when using infobox templates. I just gave this a quick glance and have not tested so please provide feedback to this thread with your results. :thumbsup:

 

Thanks,

Thanks, but that doesn't solve the problem. Looks like the same results.

Link to comment
Share on other sites

Thanks, but that doesn't solve the problem. Looks like the same results.

 

James, so your saying that if you remove the following lines from catalog/includes/classes/sts.php that your infoboxes are OK?

 

v4.5.5

  // v4.5.4, error and info message from URL were never displayed, so add them before content.
 $this->template['content'] = $this->template['error_message'].$this->template['info_message'].$this->template['content'];

 

The above line plus the following code in catalog/includes/functions/sts.php below are the only modifications between v4.5.4 and 4.5.5:

 

v4.5.5

// Modified in v4.5.5 to work with <td class="xxx"> and not only with <td>
function sts_strip_unwanted_tags($tmpstr, $commentlabel) {
 // Now lets remove the <tr><td> that the require puts in front of the tableBox
 $tablestart = strpos($tmpstr, "<td"); // v4.5.5

 

By removing the lines above, you revert v4.5.5 to v4.5.4.

If I'm reading your posts correctly, no one had the extra tr and td using version 4.5.4 but are having the problem with v4.5.5.

Edited by bkellum

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

James, so your saying that if you remove the following lines from catalog/includes/classes/sts.php that your infoboxes are OK?

 

v4.5.5

  // v4.5.4, error and info message from URL were never displayed, so add them before content.
 $this->template['content'] = $this->template['error_message'].$this->template['info_message'].$this->template['content'];

 

The above line plus the following code in catalog/includes/functions/sts.php below are the only modifications between v4.5.4 and 4.5.5:

 

v4.5.5

// Modified in v4.5.5 to work with <td class="xxx"> and not only with <td>
function sts_strip_unwanted_tags($tmpstr, $commentlabel) {
 // Now lets remove the <tr><td> that the require puts in front of the tableBox
 $tablestart = strpos($tmpstr, "<td"); // v4.5.5

 

By removing the lines above, you revert v4.5.5 to v4.5.4.

If I'm reading your posts correctly, no one had the extra tr and td using version 4.5.4 but are having the problem with v4.5.5.

 

I'm having the problem with 4.5.7.

Link to comment
Share on other sites

I'm having the problem with 4.5.7.

Looks like it was 4.5.6 that breaks it. I started with a clean 4.5.4 install. Added the 4.5.5 patches and it still worked. Then I added the 4.5.6 patches and the problem appeared.

Link to comment
Share on other sites

Looks like it was 4.5.6 that breaks it. I started with a clean 4.5.4 install. Added the 4.5.5 patches and it still worked. Then I added the 4.5.6 patches and the problem appeared.

 

 

Now what is it about 4.5.6 that broke it?

 

BTW $tablestart = strpos($tmpstr, "<td>"); Did not fix the problem for me either. I don't think that is the problem considering they left out the last bracket so that it can include the class="".

 

This line was also changed in 4.5.5 (catalog/includes/functions/sts.php).

 $tmpstr = substr($tmpstr, strpos ($tmpstr,">",$tablestart)+1); // strip off stuff before (and including <td>, v4.5.5

 

replaced that with this:

$tmpstr = substr($tmpstr, $tablestart+4)

 

That didn't fix it either. So what was changed in .6?

Link to comment
Share on other sites

Now what is it about 4.5.6 that broke it?

 

BTW $tablestart = strpos($tmpstr, "<td>"); Did not fix the problem for me either. I don't think that is the problem considering they left out the last bracket so that it can include the class="".

 

This line was also changed in 4.5.5 (catalog/includes/functions/sts.php).

 $tmpstr = substr($tmpstr, strpos ($tmpstr,">",$tablestart)+1); // strip off stuff before (and including <td>, v4.5.5

 

replaced that with this:

$tmpstr = substr($tmpstr, $tablestart+4)

 

That didn't fix it either. So what was changed in .6?

The only changes in 4.5.6 seem to be replacing ob_end_clean() with ob_clean() in a couple of the files. Does that make sense?

Link to comment
Share on other sites

Could it be the fact that we are now using ob_clean instead of ob_end_clean? I'll test it out.

 

 

Yes, that fixed it. Change ob_clean back to ob_end_clean.

 

BTW: Anyone know why ob_clean is appropriate and better performing then ob_end_clean?

 

All I know is ob_end_clean turns off output buffering after it erases it.

 

When viewing the page source I can see this code

	<!-- start cartbox //-->
	<img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>
   </tr>
   <tr>
       <td class="boxText">0 items</td>
   </tr>
   <tr>
       <td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1">
	<!-- end cartbox //-->

 

Where do I go to edit that code? I would like to get rid of the pixel_trans.gif on the top and the bottom of every box.

Edited by soldsep
Link to comment
Share on other sites

Yes, that fixed it. Change ob_clean back to ob_end_clean.

Thanks. I agree.....that looks like it solved the problem. Any idea why ob_end_clean was changed to ob_clean in the first place? Are we reintroducing another bug?

Link to comment
Share on other sites

Hi!

 

I'm not sure how to use a template for the specials box. If following the rules it should be infobox_specials.html, right? It doesn't work.

I've also tried infobox_special.html, infobox_specialbox.html and so on.

 

All other boxes are fine.

Link to comment
Share on other sites

One remark: it is better to create a new placeholders for your link, or use the tep_href_link function in your template, then place a hardcoded link. Like this you keep the osCommerce functionalities (session ID, url rewrite, ...)

 

- Chris

 

Hi Chris!

 

Just wanted to ask,are there really any differences between doing it the "right" way and placing links in the template? I have never experienced any issues with sessions etc when creating hard coded relative links directly in template files.

Link to comment
Share on other sites

There is a difference between ob_clean and ob_end_clean, otherwise there would not be 2 functions (eh eh).

Well, ob_clean only empty the buffer, while ob_end_clean destroys the buffer. The difference is important when cascading buffer, because when destroying a buffer the output continues to buffer of higher level, while if only cleaning a buffer, the output continues into the same buffer.

 

STS4 is using cascading of buffers in at least 3 levels, example when infobox template is used: 1st buffer for the GZIP function (standard osc function), 2nd buffer for the infobox, 3rd buffer to read the infobox template.

 

It is difficult to understand, I had to make an example to understand myself, the only difference in parts 1 and 2 are our famous functions. Try it, you'll see that results are different!

 

<?php
echo 'Start 1<br>';
ob_start();
echo 'After start1<br>';

ob_start();
echo 'After start2<br>';

$var2 = ob_get_contents();
ob_clean(); // Only clean, without distroying buffer.
$var1 = ob_get_contents(); // We get nothing in $var1, because buffer just cleaned
ob_clean();
echo 'No more buffering<br>';

echo '1:'.$var1.'<br>';
echo '2:'.$var2.'<br>';

echo '======================================<br>';

echo 'Start 1<br>';
ob_start();
echo 'After start1<br>';

ob_start();
echo 'After start2<br>';

$var2 = ob_get_contents();
ob_end_clean(); // Clean and destroy buffer, so we continue with next buffer
$var1 = ob_get_contents(); // Magic, there is something in $var1
ob_end_clean();
echo 'No more buffering<br>';

echo '1:'.$var1.'<br>';
echo '2:'.$var2.'<br>';
?>

 

The guy who made v4.5.6 did not test in all situations. But he is right that only cleaning is faster than destroying, but it's just not working in all situations. Have to study how to get the speed effect without breaking the layout...

Link to comment
Share on other sites

Hi!

 

I'm not sure how to use a template for the specials box. If following the rules it should be infobox_specials.html, right? It doesn't work.

I've also tried infobox_special.html, infobox_specialbox.html and so on.

 

All other boxes are fine.

 

i think it should be "infobox_specials.php.html" :huh:

OSC Webmakers Edition modiefied with many other contribs and enhancements.

+ STS 4.5.7 for 2.2MS2 and RC1

Link to comment
Share on other sites

2 Questions:

1.) How to define default Header Title or Text headings in a template depending on language ?

 

For examble:

HEADER_TITLE_CART_CONTENTS

 

The Text Tags are defined in "catalog/german.php" (or english.php)

 

2.) http://www.run-x.de/shop-2/catalog/login.php

 

...there is no login form visible.... :huh:

 

#2 is resolved - i deleted a file and that was the reason why the login page was invisible in my template.

 

#1 still open - is there a way to place language-definitions directly into a template (without box contents) in a simple way ? The Template should use the language tags from "catalog/includes/languages/german.php, english.php......

OSC Webmakers Edition modiefied with many other contribs and enhancements.

+ STS 4.5.7 for 2.2MS2 and RC1

Link to comment
Share on other sites

Hi Bill,

 

Well I have installed the latest version and the problem only occurs when I have set the option "Use template for infoboxes" to true.

 

I hope you can help me.

 

Edit: Well I have solved it. It is very strange but when I added the following attributes to the HTML tag it worked.

xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl"

 

I had the same problem, see my solution in: http://www.oscommerce.com/forums/index.php?s=&...t&p=1154947

 

There might also be a problem in de store language because mine was also dutch?? I have no idea if it has anything to do with it or that it is just coincidence.

 

The file i mention in my previous post has only 4 lines that differ and only 2 of them have something to do with the layout problem.

Link to comment
Share on other sites

I am having a problem that I need some help on. I've been using STS 4.3 for about 10 months along with FEC with no problems, but I recently made some changes to integrate PayPal WPP. For some reason I can't get the navigation buttons at the bottom of the payment page to appear.

 

If I turn off STS, everything is fine, but when I turn it on they are omitted from the output. This code being omitted is certainly before the

<!-- body_text_eof //--> line. Is there something else that might be truncating the text?

 

Of course, an obvious question is "what have I changed?". I have restructured the HTML a little because it had many "no closing tag" errors (though I can't be sure I've fixed this yet). Do closing tags have any impact here?

 

Thanks for any help,

Robert

Link to comment
Share on other sites

There is a difference between ob_clean and ob_end_clean, otherwise there would not be 2 functions (eh eh).

Well, ob_clean only empty the buffer, while ob_end_clean destroys the buffer. The difference is important when cascading buffer, because when destroying a buffer the output continues to buffer of higher level, while if only cleaning a buffer, the output continues into the same buffer.

 

STS4 is using cascading of buffers in at least 3 levels, example when infobox template is used: 1st buffer for the GZIP function (standard osc function), 2nd buffer for the infobox, 3rd buffer to read the infobox template.

 

It is difficult to understand, I had to make an example to understand myself, the only difference in parts 1 and 2 are our famous functions. Try it, you'll see that results are different!

 

<?php
echo 'Start 1<br>';
ob_start();
echo 'After start1<br>';

ob_start();
echo 'After start2<br>';

$var2 = ob_get_contents();
ob_clean(); // Only clean, without distroying buffer.
$var1 = ob_get_contents(); // We get nothing in $var1, because buffer just cleaned
ob_clean();
echo 'No more buffering<br>';

echo '1:'.$var1.'<br>';
echo '2:'.$var2.'<br>';

echo '======================================<br>';

echo 'Start 1<br>';
ob_start();
echo 'After start1<br>';

ob_start();
echo 'After start2<br>';

$var2 = ob_get_contents();
ob_end_clean(); // Clean and destroy buffer, so we continue with next buffer
$var1 = ob_get_contents(); // Magic, there is something in $var1
ob_end_clean();
echo 'No more buffering<br>';

echo '1:'.$var1.'<br>';
echo '2:'.$var2.'<br>';
?>

 

The guy who made v4.5.6 did not test in all situations. But he is right that only cleaning is faster than destroying, but it's just not working in all situations. Have to study how to get the speed effect without breaking the layout...

 

Excellent point Chris and great examples.

 

I have not implemented the v4.5.6 version yet so I could not duplicate the problems others were having with the infobox template layout. I agree that this needs to go deeper than what is suggested in v4.5.6.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Hi Chris!

 

Just wanted to ask,are there really any differences between doing it the "right" way and placing links in the template? I have never experienced any issues with sessions etc when creating hard coded relative links directly in template files.

If you have "force cookies" in your shops admin, then the session links are not an issue. However, managing your sessions in the database is a more optimized way of doing it and that requires that you setup your links the right way.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Hi!

 

I'm not sure how to use a template for the specials box. If following the rules it should be infobox_specials.html, right? It doesn't work.

I've also tried infobox_special.html, infobox_specialbox.html and so on.

 

All other boxes are fine.

Are you sure you don't have something in your stylesheet.css that may be overiding your changes? Also, have you modified the specials.php file in any way that might prevent the template from working?

 

You should be using STSv4.5.5 for the infobox templates to be working as designed.

 

My stylesheet infobox portion:

 

/*This is the INFOBOX Background Style, one shade darker than the Infobox Header color*/
.infoBox {
 background: #0000FF;
}

/*This is the INFOBOX Contents Style, one shade lighter than the Infobox Header color*/
.infoBoxContents {
 background: #FFFFFF;
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

/*This is the INFOBOX Notice Style, a pale salmon color*/
.infoBoxNotice {
 background: #FF8E90;
}

/*This is the INFOBOX Notice Contents Style, a very pale salmon color*/
.infoBoxNoticeContents {
 background: #FFFFFF;
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

/*This is the INFOBOX Heading Style, SAME AS HEADER AND FOOTER GRAY BARS*/
TD.infoBoxHeading {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
 font-weight: bold;
 background: #FFFFFF;
 color: #0000FF;
}

TD.infoBox, SPAN.infoBox {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

If you have "force cookies" in your shops admin, then the session links are not an issue. However, managing your sessions in the database is a more optimized way of doing it and that requires that you setup your links the right way.

 

Seems like it is working fine with relative links in templates and without using "force cookies". Could it be issues in just some browsers the way I am doing it? I have not experienced problems using Safari and Firefox. I think I had problems with cart loosing products a couple of years ago, but not nowadays.

Link to comment
Share on other sites

Excellent point Chris and great examples.

 

I have not implemented the v4.5.6 version yet so I could not duplicate the problems others were having with the infobox template layout. I agree that this needs to go deeper than what is suggested in v4.5.6.

 

I think I had problems with 4.5.6 since that version didn't include the service pack 2, which was uploaded earlier. The infobox templates didn't work and the template became a real mees when settings infobox templates 'true' in admin. Therefor I uploaded a 4.5.7 with all recent changes (4.5.4 + 4.5 SP5 + 4.5.6).

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