Guest Posted October 18, 2005 Share Posted October 18, 2005 I found out that this is the coded in boxes.php that produces the html code for the categories, class infoBox extends tableBox { function infoBox($contents) { $info_box_contents = array(); $info_box_contents[] = array('text' => $this->infoBoxContents($contents)); $this->table_cellpadding = '1'; $this->table_parameters = 'class="infoBox"'; $this->tableBox($info_box_contents, true); } function infoBoxContents($contents) { $this->table_cellpadding = '3'; $this->table_parameters = 'class="infoBoxContents"'; $info_box_contents = array(); $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); for ($i=0, $n=sizeof($contents); $i<$n; $i++) { $info_box_contents[] = array(array('align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''), 'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''), 'params' => 'class="boxText"', 'text' => (isset($contents[$i]['text']) ? $contents[$i]['text'] : ''))); } $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); return $this->tableBox($info_box_contents); } } This output this html code; <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="/webshop/images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td> </tr> <tr> </tr> <tr> </tr> <tr> <td class="boxText"> How can I change the boxes.php file to make me define a class to the TD tag, so that the output is like this; <table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox"> <tr> <td class="class"><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents"> <tr> <td><img src="/webshop/images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td> </tr> <tr> </tr> <tr> </tr> <tr> <td class="boxText"> The different is that in the third line, the TD tag has defined a class now.... Can anyone help me? Link to comment Share on other sites More sharing options...
Guest Posted October 19, 2005 Share Posted October 19, 2005 you could pass the params field of the box with the class you want. If you need to use the same code ( alternativaly you could create a new class and customize it) set the info_box_contents[] (in the file that calls the new infobox and instantiates the class) to set a separate element for the one with the new class (for example for the first one). Then insert the rest of it. So the first element you insert you setup the params field to the class you want. Link to comment Share on other sites More sharing options...
Guest Posted October 19, 2005 Share Posted October 19, 2005 you could pass the params field of the box with the class you want. If you need to use the same code ( alternativaly you could create a new class and customize it) I'v tried to pass the parsm filed into the current boxes.php, but I can't figure out where to past in into the code. I'v also tried to make a new class, but I can't get it work. When I tried that, I made a new class, but since it's it's not gonna contain anything els then wrap a table arount the rest of the content, I made a empty class, that only just create a table with parms, class="myclass". But that suddendly poped up some where totaly unexpected. I really would love to se a php-code example. Link to comment Share on other sites More sharing options...
Guest Posted October 19, 2005 Share Posted October 19, 2005 Ok see how the catalog\includes\boxes\information.php is set and modified it slightly to add an extra entry to the array. So you can see you could set it up like this 1. It creates the header of the box by using the infoBoxHeading class (you could similarly setup a class that places a bold or background color and call it say infoBoxFirstEntry. $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION); new infoBoxHeading($info_box_contents); $info_box_contents = array(); $info_box_contents[] = array('text' => 'First Entry Goes Here', 'params' => 'class="infoBoxFirstElement"); new infoBoxFirstEntry($info_box_contents); // Other code & entries here That would require an extra class in the includes\classes\boxes.php class infoBoxFirstEntry extends tableBox { function infoBoxFirstEntry($contents) { $this->table_parameters = 'class="infoBoxFirstEntry"'; $this->tableBox($contents, true); } } then define the .css classes in your .css file the way you want. (TABLE.infoBoxFirstEntry and TR TD for infoBoxFirstElement) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.