newmeat Posted April 16, 2008 Posted April 16, 2008 Hi all....newbie so please be gentle!!! Been searching through the site and haven't found the answer to my question. I understand that the stylesheet controls the 'look' of the text etc. I also understand that the A and A:hover ref's control the colour of all linked text through out the site. I have just spent some time setting up my left hand side categories so that the background is blue and the text is white. This looks just how I want it to. One big problem.....the text for the product short description is now white on a white background! :'( I have had a look at categories.php to see if A or A:hover is mentions so that I could create a second set but no luck. Anyone any ideas how I can get the left hand links to look different to the rest??
Guest Posted April 16, 2008 Posted April 16, 2008 If you want a different link color for your categories in your left column do this In catalog/includes/boxes/categories.php find $categories_string .= '<a href="'; Change to $categories_string .= '<a class="your_class" href="'; In catalog/stylesheet.css add your new class like so A.your_class { color: #000000; text-decoration: none; } A.your_class:hover { color: #FF0000; text-decoration: underline; } Then put your A and A:hover back to what you want for the rest of your site.
newmeat Posted April 17, 2008 Author Posted April 17, 2008 Hi Brian Many thanks for that but..... I don't have $categories_string .= '<a href="'; in catalog/includes/boxes/categories.php !!!! I have had a look at the install file and its there but not in mine?! I have tried adding it, creating the new class, uploading all files but it doesn't change anything. My files looks like this: <?php /* $id: Great Categories v2.1 2005/07/09 14:00:00 willross Exp $ http://www.palaia.com/ujp/ - [email protected] *** For use with standard install of osCommerce 2.2MS2+ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2005 osCommerce Released under the GNU General Public License */ function tep_show_category($counter) { global $tree, $categories_string, $cPath_array, $aa; for ($a=0; $a<$tree[$counter]['level']; $a++) { // $categories_string .= " "; } //category start if ($tree[$counter]['level'] == 0) { if ($aa == 1) { $categories_string .= '<img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="2"><br><img src="images/pixel_ltgray.gif" border="0" alt="" width="100%" height="1"><br><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="2">'; } else {$aa=1;} Where as the install file is: <?php /* $Id: categories.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= " "; } $categories_string .= '<a href="'; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } Any ideas??
♥Monika in Germany Posted April 17, 2008 Posted April 17, 2008 you will have to look a bunch of lines deeper down if you are using great categories - a contrib :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
newmeat Posted April 17, 2008 Author Posted April 17, 2008 Hi Monika Do you mean in categories.php or in another file? My ctegories.php is: <?php /* $id: Great Categories v2.1 2005/07/09 14:00:00 willross Exp $ http://www.palaia.com/ujp/ - [email protected] *** For use with standard install of osCommerce 2.2MS2+ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2005 osCommerce Released under the GNU General Public License */ function tep_show_category($counter) { global $tree, $categories_string, $cPath_array, $aa; for ($a=0; $a<$tree[$counter]['level']; $a++) { // $categories_string .= " "; } //category start if ($tree[$counter]['level'] == 0) { if ($aa == 1) { $categories_string .= '<img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="2"><br><img src="images/pixel_ltgray.gif" border="0" alt="" width="100%" height="1"><br><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="2">'; } else {$aa=1;} } if ($tree[$counter]['level'] == 0) {$categories_string .= '<div id="topcat">';} if ($tree[$counter]['level'] == 1) {$categories_string .= '<div id="secondcat">';} if ($tree[$counter]['level'] == 2) {$categories_string .= '<div id="thirdcat">';} if ($tree[$counter]['level'] == 3) {$categories_string .= '<div id="fourthcat">';} if ($tree[$counter]['level'] == 4) {$categories_string .= '<div id="fifthcat">';} $categories_string .= '<a'; if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) { $categories_string .= ' class="activelink"'; } if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= ' href="'.tep_href_link(FILENAME_DEFAULT, $cPath_new); $categories_string .= '">'; // display category name if (tep_has_category_subcategories($counter) || $tree[$counter]['level'] == 0) { if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) { $categories_string .= '<span class="catwithsubs">'.tep_image(DIR_WS_IMAGES . 'categories/arrow_down.gif', '', '9', '9') . "</span>"; } else { $categories_string .= '<span class="catwithsubs">'.tep_image(DIR_WS_IMAGES . 'categories/arrow_right.gif', '', '9', '9') . "</span>"; } } else { $categories_string .= '<span class="catwithnosubs">' .tep_image(DIR_WS_IMAGES . 'categories/arrow_bullet.gif', 'nokta', '9', '9') . "</span>"; } //category name $categories_string .= $tree[$counter]['name']; if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) { //end of active link $categories_string .= ''; } 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>'; $categories_string .= '</div>'; if ($tree[$counter]['next_id']) { tep_show_category($tree[$counter]['next_id']); } } ?> <!-- categories //--> <tr> <td> <?php // $info_box_contents = array(); // $info_box_contents[] = array('align' => 'left', // 'text' => BOX_HEADING_CATEGORIES); // new CategoriesBoxHeading($info_box_contents, true, false); $categories_string = '<div id="thecategories">'; $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)) { $tree[$categories['categories_id']] = array( 'name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false); if (isset($parent_id)) { $tree[$parent_id]['next_id'] = $categories['categories_id']; } $parent_id = $categories['categories_id']; if (!isset($first_element)) { $first_element = $categories['categories_id']; } } //------------------------ if ($cPath) { $cPath_array = split('_', $cPath); reset($cPath_array); while (list($key, $value) = each($cPath_array)) { $new_path .= $value; unset($parent_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)) { $tree[$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($parent_id)) { $tree[$parent_id]['next_id'] = $row['categories_id']; } $parent_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } if ($category_check != 0) { $tree[$last_id]['next_id'] = $tree[$value]['next_id']; $tree[$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.'</div>'); new CategoriesBox($info_box_contents); ?> </td> </tr> <!-- categories_eof //--> and $categories_string .= '<a href="'; Doesn't appear once.......now I am confused!!! :wacko:
♥Monika in Germany Posted April 17, 2008 Posted April 17, 2008 it's this part: $categories_string .= '<a'; if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) { $categories_string .= ' class="activelink"'; } you need to recode this section so it's a whole string like above, with an if/else, and both versions having a class. then you style those 2 classes in your stylesheet. Have fun! :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
newmeat Posted April 17, 2008 Author Posted April 17, 2008 Thanks Monica I did try changing it to $categories_string .= '<a class="A1"'; Where A1 was the class for the categories but it didn't change anything. Not so hot on php so is there more that I need to be adding?
Guest Posted April 17, 2008 Posted April 17, 2008 Monika, Monika, where for art thou Monika!!! Can you, pretty please, help me with the, pretty please, code pretty please????
newmeat Posted April 18, 2008 Author Posted April 18, 2008 Can someone please explain what the if/else would do? and what the code would be?
♥Monika in Germany Posted April 18, 2008 Posted April 18, 2008 Paul, I posted above what you need to do ... combine the 2 string parts into one, and add an else. if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) { $categories_string .= '<a class="activelink"'; } else { $categories_string .= '<a class="notactivelink"'; } and in stylesheet.css, you need to style your activelink class, and add a second class for notactivelink, also styled If you are new to php, you need to read existing code. Find code that is already done (osC is full of it) and make small changes, not like in major contributions like great categories. It's no wonder if you as a newbie loose track then. A good book might work wonders also. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
newmeat Posted April 18, 2008 Author Posted April 18, 2008 Hi Monika Tried that code in categories.php and put two new classes in the stylesheet if ( ($cPath_array) && (@in_array($counter, $cPath_array)) ) { $categories_string .= '<a class="cat1"'; } else { $categories_string .= '<a class="noncat1"'; } .cat1 { color: #ffffff; text-decoration: none; } .noncat1 { color: #003399; text-decoration: none; } It works for the hover but now I have no text at all when normal..... Am I being really thick???
♥Monika in Germany Posted April 18, 2008 Posted April 18, 2008 as both are classes in links, they have to be a.XXXX classes :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
newmeat Posted April 18, 2008 Author Posted April 18, 2008 Ok so they should be a.cat1 and a.noncat1??? tried that in the stylesheet but no joy have a look at My Website Monica you have the patience of a saint and I know I should be reading up on this, but please one last bit of advice?
♥Monika in Germany Posted April 18, 2008 Posted April 18, 2008 you seem to have chosen the same color for the font on your links in the else part as you have for the background color... the text is there, just blue on blue doesn't show. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
newmeat Posted April 18, 2008 Author Posted April 18, 2008 You my friend, are a genius. Many, many, many thanks for bearing with me through that. Every day is a school day!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.