Guest Posted September 28, 2002 Share Posted September 28, 2002 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 More sharing options...
Guest Posted September 28, 2002 Share Posted September 28, 2002 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 More sharing options...
Guest Posted September 28, 2002 Share Posted September 28, 2002 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 More sharing options...
Guest Posted September 28, 2002 Share Posted September 28, 2002 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 More sharing options...
Guest Posted September 28, 2002 Share Posted September 28, 2002 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 More sharing options...
Guest Posted September 30, 2002 Share Posted September 30, 2002 If anyone can help me with this I will squirt some money into their paypal account! I'm going insane here trying to get the bloomin' thing to work! Link to comment Share on other sites More sharing options...
Guest Posted September 30, 2002 Share Posted September 30, 2002 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 More sharing options...
Guest Posted September 30, 2002 Share Posted September 30, 2002 Funny you should mention that ;) I had one ready and was about to post it... http://0free.com/ideawhatisneeded.jpg (note the thin black border around the overall box and the slightly grey area in the top part of the box) I really appreciate you taking a look for me :) Link to comment Share on other sites More sharing options...
Guest Posted October 1, 2002 Share Posted October 1, 2002 /* $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 More sharing options...
Guest Posted October 1, 2002 Share Posted October 1, 2002 Did you see the graphic I posted? ;) Link to comment Share on other sites More sharing options...
burt Posted October 1, 2002 Share Posted October 1, 2002 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 More sharing options...
burt Posted October 1, 2002 Share Posted October 1, 2002 The code above btw makes a box like this: http://www.xwww.co.uk/test/ HTH Link to comment Share on other sites More sharing options...
Guest Posted October 1, 2002 Share Posted October 1, 2002 Hi Yes Gary's code works for me too! And it works just working with the css file... as it should! :) Link to comment Share on other sites More sharing options...
Guest Posted October 1, 2002 Share Posted October 1, 2002 Thanks Gary, really appreciated - I will have a good play with it now.... Link to comment Share on other sites More sharing options...
Guest Posted October 1, 2002 Share Posted October 1, 2002 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 More sharing options...
Guest Posted October 1, 2002 Share Posted October 1, 2002 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 More sharing options...
burt Posted October 2, 2002 Share Posted October 2, 2002 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 More sharing options...
burt Posted October 2, 2002 Share Posted October 2, 2002 Remove the css from the overall table and apply it to the td only. HTH Link to comment Share on other sites More sharing options...
Guest Posted October 2, 2002 Share Posted October 2, 2002 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 More sharing options...
Guest Posted October 2, 2002 Share Posted October 2, 2002 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 More sharing options...
Guest Posted September 5, 2005 Share Posted September 5, 2005 Thank you osmosis, I had been trying to sort this problem out for the last few hours! I had the exact same problem as Tim Link to comment Share on other sites More sharing options...
ltreml Posted February 27, 2007 Share Posted February 27, 2007 Hi TimThose 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.