Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Boxes Border Help Needed - Thin Black Box Wanted!


Guest

Recommended Posts

I'm trying to get a very thin black box (border) around my boxes (such as the shopping basket, bestsellers boxes etc etc.) My usual way of doing this is to have a table with a black background (with a bit of cellpadding) and then put a table inside it with a white background - this way a nice cross-browser thin black border is seen around the table/box.

 

However, when I try and add the following HTML to the includes/classes/boxes.php file:

 

<TABLE class=infoBox cellSpacing=0 cellPadding=1 width=100% border=0><TBODY><TR><TD bgcolor=#000000>

 

This does produce a nice thin box around the box - but it repeats this for the box contents inside and therefore doubles up the box effect. Blah.

 

So, how can I get this to only display the thin black border around the overall box? And not repeat with every table inside?

 

Here is the code I am using below (my added bits in bold):

 

 

<?php

/*

$Id: boxes.php,v 1.28 2002/06/01 18:44:37 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

class tableBox {

var $table_border = '0';

var $table_width = '100%';

var $table_cellspacing = '0';

var $table_cellpadding = '4';

var $table_parameters = '';

var $table_row_parameters = '';

var $table_data_parameters = '';

 

// class constructor

function tableBox($contents, $direct_output = false) {

$tableBox_string = '<TABLE class=infoBox cellSpacing=0 cellPadding=1 width=100% border=0><TBODY><TR><TD bgcolor=#000000><table border="' . $this->table_border . '" width="' . $this->table_width . '" cellspacing="' . $this->table_cellspacing . '" cellpadding="' . $this->table_cellpadding . '"';

if ($this->table_parameters != '') $tableBox_string .= ' ' . $this->table_parameters;

$tableBox_string .= '>' . "n";

 

and so on...

 

}

 

$tableBox_string .= '</table></TD></TR></TBODY></TABLE>' . "n";

Link to comment
Share on other sites

Hi Tim

 

Use CSS!!

 

With an

border-color: #000000; border-style: solid; border-width: 1px;

line in the right place you will have it working!

 

Best regards

Link to comment
Share on other sites

That is a better idea, Thanks! However, it still repeats as explained in my first post :(

 

Unless I am putting it in the wrong place?

 

// class constructor

function tableBox($contents, $direct_output = false) {

$tableBox_string = '<table style="border-color: #000000; border-style: solid; border-width: 1px;" border="' . $this->table_border . '" width="' . $this->table_width . '" cellspacing="' . $this->table_cellspacing . '" cellpadding="' . $this->table_cellpadding . '"';

if ($this->table_parameters != '') $tableBox_string .= ' ' . $this->table_parameters;

$tableBox_string .= '>' . "n";

Link to comment
Share on other sites

Hi Tim

 

Why dont you try adding the style to the stylesheet.css file?

 

Its always better to keep all styles in that file, instead of put them in the classes.

 

Try adding that line to the infoboxes styles

Link to comment
Share on other sites

Well, I must be Mr Thick from the Planet Thick. I've tried adding it to stylesheet on the Infoboxes - but it either adds the thickness to just the top of the table or repeats it twice over the whole thing *brain freeze*

Link to comment
Share on other sites

Hi Tim

 

I still dont understand what you need.

I though I do, but it seems I dont :)

 

Can you do any kind of example maybe in Photo Shop or anything to show me what is what you cant do?

 

If I understand you well, surely I will be able to help you.

 

Dont worry about the money in PayPal... those bastards dont let me receive money in my account ;)

 

Best regards

Link to comment
Share on other sites

/*

$Id: boxes.php,v 1.28 2002/06/01 18:44:37 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

class tableBox {

var $table_border = '0';

var $table_width = '100%';

var $table_cellspacing = '0';

var $table_cellpadding = '0';

var $table_parameters = '';

var $table_row_parameters = '';

var $table_data_parameters = '';

 

 

Works fine for me :)

 

www.petdirect.com.au

Link to comment
Share on other sites

Might take a bit of playing around, but best bet is to update your stylesheet...

 

Add to infoBoxheading (creates the border and the grey background)

background-color: #eeeeee; border: #000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px

Add to infoBox (creates the border)

border: #000000; border-style: solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px

 

Its a step in the right direction anyhow...

Link to comment
Share on other sites

Did you see the graphic I posted? ;)

 

Now that I have taken another (closer) look at it, no! :)

 

It looks as if you have been happily sorted anyway, just ignore me in future, most people find it saves time LOL

Link to comment
Share on other sites

Thanks anyway David :)

 

Okay - been playing around with this for a few hours and although it works "clean" - when I add it to the boxes I get two extra lines in the top part of the box:

 

http://0free.com/oddlooking.jpg

 

This is because the infoBoxHeading is being used on it.. any suggestions on how to get rid of those black line things without affecting the rest of the box? I am trying, as suggested, to only do this via the Stylesheet....

Link to comment
Share on other sites

This is because the infoBoxHeading is being used on it.. any suggestions on how to get rid of those black line things without affecting the rest of the box? I am trying, as suggested, to only do this via the Stylesheet....

 

Post the exact CSS code you are using as a .txt file to your webspace so that we may have a look. Without more info its kinda hard to help ;)

Link to comment
Share on other sites

Hi Tim

 

Those lines you are seeing are because of the left and right corners of the infoboxes.

 

The infoBoxHeading class is made to show or not those cornes, but even when you set them to false, the TDs are generated. That's why you see those lines.

 

You can hack the /catalog/includes/classes/boxes.php file and in the infoBoxHeading class contructor modify from this:

 

      $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"', 'text' => $left_corner),

                                  array('params' => 'width="100%" height="14" class="infoBoxHeading"', 'text' => $contents[0]['text']),

                                  array('params' => 'height="14" class="infoBoxHeading"', 'text' => $right_corner));

 

To this:

 

      $info_box_contents[] = array(array('params' => 'width="100%" height="14" class="infoBoxHeading"', 'text' => $contents[0]['text']));

 

BE CAREFUL!

With this modification, ALL your infoboxes will NOT have right or left corners.

 

You can also work a little more and make the class to NOT create those TDs when you set the corners to false, but at least with this modification your boxes should look fine.

 

I hope it helps!

Link to comment
Share on other sites

Thank you!!! Yes, that's done it. I had a feeling a tiny bit of hacking was in order ;)

 

Thanks to both of you for taking the time to solve this issue for me :)

Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...
Hi Tim

Those lines you are seeing are because of the left and right corners of the infoboxes.

The infoBoxHeading class is made to show or not those cornes, but even when you set them to false, the TDs are generated. That's why you see those lines.

You can hack the /catalog/includes/classes/boxes.php file and in the infoBoxHeading class contructor modify from this:

	  $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"', 'text' => $left_corner),

							   array('params' => 'width="100%" height="14" class="infoBoxHeading"', 'text' => $contents[0]['text']),

							   array('params' => 'height="14" class="infoBoxHeading"', 'text' => $right_corner));

To this:

	  $info_box_contents[] = array(array('params' => 'width="100%" height="14" class="infoBoxHeading"', 'text' => $contents[0]['text']));

BE CAREFUL!

With this modification, ALL your infoboxes will NOT have right or left corners.

You can also work a little more and make the class to NOT create those TDs when you set the corners to false, but at least with this modification your boxes should look fine.

I hope it helps!

 

I've tried this code to remove the right and left corner boxes, but I get an Unexpected T-string error, expecting ')'

Is this code for an older version? I'm using MS2.2, need some help....

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...