johnnyosc Posted January 30, 2003 Share Posted January 30, 2003 I'm trying to edit the category box where the menu is displayed so that the font will be a different color then the rest of the site that has a link associated with the text. I want to add a new "class" to the style sheet. Where in the boxes/category.php file should i define my new style sheet class? I want the box text color in the menu to be a different color then the box text font in displayed product in column, therefore im defining a new style sheet class but i dont know where to insert it. Here is the code im using for categories.php function tep_show_category($counter) { global $foo, $categories_string, $id; for ($a=0; $a<$foo[$counter]['level']; $a++) { $categories_string .= " "; } $categories_string .= '<a href="'; if ($foo[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $foo[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new); $categories_string .= '">'; if ( ($id) && (in_array($counter, $id)) ) { $categories_string .= '<b>'; } // display category name $categories_string .= $foo[$counter]['name']; if ( ($id) && (in_array($counter, $id)) ) { $categories_string .= '</b>'; } if (tep_has_category_subcategories($counter)) { $categories_string .= '->'; } $categories_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; if ($foo[$counter]['next_id']) { tep_show_category($foo[$counter]['next_id']); } } ?> <!-- categories //--> <!-- This is where you will include you custom box header, left column and open up your Cell for your center column Make sure you leave the first 2 tags in here "<tr> and <td>" they maintain the control over your entire page. If you remove these tags all of you info will be shifted below you categories box on your pages. If you dont Believe me, try it....lol. //--> <tr> <td> <TABLE WIDTH=173 BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR> <TD COLSPAN=3> <IMG SRC="images/boxes/table_categories.gif" WIDTH=173 HEIGHT=20></TD> </TR> <TR> <td> <?php $categories_string = ''; $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $foo[$categories['categories_id']] = array( 'name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo[$prev_id]['next_id'] = $categories['categories_id']; } $prev_id = $categories['categories_id']; if (!isset($first_element)) { $first_element = $categories['categories_id']; } } //------------------------ if ($cPath) { $id = split('_', $cPath); reset($id); while (list($key, $value) = each($id)) { $new_path .= $value; unset($prev_id); unset($first_id); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $value . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); $category_check = tep_db_num_rows($categories_query); while ($row = tep_db_fetch_array($categories_query)) { $foo[$row['categories_id']] = array( 'name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key+1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo[$prev_id]['next_id'] = $row['categories_id']; } $prev_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } if ($category_check != 0) { $foo[$last_id]['next_id'] = $foo[$value]['next_id']; $foo[$value]['next_id'] = $first_id; } $new_path .= '_'; } } tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => $categories_string ); new infoBox($info_box_contents); ?> <!-- This is where you will close your center cell and include your right side of your box and then finally close out your custom box. Be sure and leave the "</td> and </tr>" tags. they ensure the sanctity of your overall page layout. //--> </TD> </TR> <TR> <TD COLSPAN=3> <IMG SRC="images/boxes/table_footer1.gif" WIDTH=173 HEIGHT=20></TD> </TR> </TABLE> </td> </tr> <!-- categories_eof //--> Link to comment Share on other sites More sharing options...
tcpinhead Posted January 30, 2003 Share Posted January 30, 2003 I recently had a similar request and found it was not too difficult. see this thread for more details. I was only needing to change the link colors but found what I needed. Link to comment Share on other sites More sharing options...
gdfwilliams Posted January 30, 2003 Share Posted January 30, 2003 TO ADD A NEW INFOBOX FORMAT: In your above code, define which infobox builder you're using here: new infoBox($info_box_contents); If you're defining a NEW infobox, change it to: new infoBox_new($info_box_contents); and go into includes/classes/boxes.php and find: 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(); $size = sizeof($contents); $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); for ($i=0; $i<$size; $i++) { $info_box_contents[] = array(array('align' => $contents[$i]['align'], 'form' => $contents[$i]['form'], 'params' => 'class="boxText"', 'text' => $contents[$i]['text'])); } $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); return $this->tableBox($info_box_contents); } } And AFTER that insert: class infoBox_new extends tableBox { function infoBox_new($contents) { $info_box_contents = array(); $info_box_contents[] = array('text' => $this->infoBoxContents_new($contents)); $this->table_cellpadding = '1'; $this->table_parameters = 'class="infoBox"'; $this->tableBox($info_box_contents, true); } function infoBoxContents_new($contents) { $this->table_cellpadding = '3'; $this->table_parameters = 'class="infoBoxContents"'; $info_box_contents = array(); $size = sizeof($contents); $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); for ($i=0; $i<$size; $i++) { $info_box_contents[] = array(array('align' => $contents[$i]['align'], 'form' => $contents[$i]['form'], 'params' => 'class="boxText"', 'text' => $contents[$i]['text'])); } $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); return $this->tableBox($info_box_contents); } } Now, take a look at the above and change class references, cellpadding, cellspacing, . A sample of what you can do can be seen here: http://www.magshack.com/product_info.php?p...roducts_id=2062 (still under development) Good luck, Greg Link to comment Share on other sites More sharing options...
CC Posted January 30, 2003 Share Posted January 30, 2003 Speaking of which Greg. I am still wanting to get round to looking into that code. Have you got any further with it recently? Maybe some thing new and cleaner I can work from? ta. CC. Link to comment Share on other sites More sharing options...
johnnyosc Posted January 30, 2003 Author Share Posted January 30, 2003 hello Greg, I tried your code but it doesn't seem to work for me? What should the correct code to define the new class in the style sheets if i want the font to be size 11, text color to be 666666, and link color to be white? btw my class name is infoBox_categories. thanks for your help. johnnyosc Link to comment Share on other sites More sharing options...
gdfwilliams Posted January 30, 2003 Share Posted January 30, 2003 Just cut and paste of of your current stylesheet: .infoBox_categories { font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #666666; font-weight: bold; } A.infoBox_categories { font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #FFFFFF; font-weight: bold; } A.infoBox_categories:hover { font-family: Verdana, Arial, sans-serif; font-size: 11px; color: #FFFFFF; font-weight: bold; text-decoration: underline; } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.