altDev Posted July 26, 2005 Share Posted July 26, 2005 Has anyone figured out how to add "alt tags" to text links? I noticed that all pictures already have them but I can't seem to find it anywhere whithin this forum how to add them to links. Thanks! James Scheller Link to comment Share on other sites More sharing options...
Jack_mcs Posted July 26, 2005 Share Posted July 26, 2005 Alt tags aren't used in text links. You can use title though: <a title="some text" href=... Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
altDev Posted July 27, 2005 Author Share Posted July 27, 2005 Well, I have been doing some major research in SEO'ing and found that "alt tags" for text links are extremely helpful. I Know how to accomplish this with html but php is a different story. OSC already provides "alt tags" for images automaticly but not for text links. James Scheller Link to comment Share on other sites More sharing options...
altDev Posted July 27, 2005 Author Share Posted July 27, 2005 I believe "alt tags" are also called "anchor text" for text links. James Scheller Link to comment Share on other sites More sharing options...
Halfpint Posted July 27, 2005 Share Posted July 27, 2005 I believe "alt tags" are also called "anchor text" for text links. <{POST_SNAPBACK}> Anchor text is the actual text of a hyperlink and lies between the <a> and </a> tags. The format of your anchor tag that defines both the source and destination of a hyperlink should look like this: <a "href=http://www.domain-name.com/descripitive-title.html">descriptive text including keyword or phrase</a> Link to comment Share on other sites More sharing options...
altDev Posted July 27, 2005 Author Share Posted July 27, 2005 I got it! thanks guys.. my code looks like this.. <a href="' . tep_href_link(FILENAME_ORDER) . '"TITLE="How to Order">' . BOX_INFORMATION_ORDER . '</a><br>' . I am still working on the catagories.. but I think I got it. Thanks again! :lol: James Scheller Link to comment Share on other sites More sharing options...
altDev Posted July 27, 2005 Author Share Posted July 27, 2005 OK, so maybe I dont got it.. ugh.. So, if you have a visible <a href...> link, its easy to add the alt tag but now comes the tricky PHP stuff. I am stuck on catagories.php to add a alt tag or title tag to each catagory name. Can a PHP'r check this out and see if it can be done? Thanks a million in advance! Jaymz James Scheller Link to comment Share on other sites More sharing options...
Jack_mcs Posted July 27, 2005 Share Posted July 27, 2005 Again, alt tags are not allowed on text links. However, for your categories problem, find this code in includes/boxes/categories.php $categories_string .= '::<a href="'; and change it to $categories_string .= '::<a title='.$tree[$counter]['name'].'href="'; Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
altDev Posted July 28, 2005 Author Share Posted July 28, 2005 I tryed the above code and it just froze the links. (I couldn't click em) take a look at our site and hold your mouse over the links within the info box, thats what I am after but dynamicly within the catagories box. Well, maybe its not possible but it would be alot cooler if it was :) Our Site Jaymz James Scheller Link to comment Share on other sites More sharing options...
Jack_mcs Posted July 28, 2005 Share Posted July 28, 2005 The code should work. But if you have a contribution installed that changes the categories box, I suppose it could fail. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
altDev Posted July 29, 2005 Author Share Posted July 29, 2005 Hmm.. I will play with it some more. I don't see any contribution that deal with the catagories at all but who knows.. thanks for your help, I do appreciate it. :D James Scheller Link to comment Share on other sites More sharing options...
altDev Posted July 29, 2005 Author Share Posted July 29, 2005 Here is my code with new href tag: <?php /* $Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $ 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 title='.$tree[$counter]['name'].'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>'; } // display category name $categories_string .= $tree[$counter]['name']; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $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 ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } } ?> <!-- categories //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); new infoBoxHeading($info_box_contents, true, false); $categories_string = ''; $tree = array(); $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='" . (int)$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 (tep_not_null($cPath)) { $new_path = ''; reset($cPath_array); while (list($key, $value) = each($cPath_array)) { 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 = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query)) { $new_path .= $value; 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']; } $tree[$last_id]['next_id'] = $tree[$value]['next_id']; $tree[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); ?> </td> </tr> <!-- categories_eof //--> Here is my test site whre you can see what its doin. Test Site Jaymz James Scheller Link to comment Share on other sites More sharing options...
MarcoZorro Posted July 30, 2005 Share Posted July 30, 2005 Remove $categories_string .= '::<a title='.$tree[$counter]['name'].'href="'; and replace it with the default code. $categories_string .= '<a href="'; Then change $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; To be $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '" title="' . $tree[$counter]['name'] . '">'; Link to comment Share on other sites More sharing options...
altDev Posted August 1, 2005 Author Share Posted August 1, 2005 OK, first off.. thank you so much, that is exactly what I was after but.. I know, I know, but what? Well, if its possible and not a big deal, how can that same thing apply to the sub-catagories? If you have time to see, that would be great, if not dont fret it, I am so excited it works! Thanks Again!! Jaymz James Scheller Link to comment Share on other sites More sharing options...
altDev Posted August 1, 2005 Author Share Posted August 1, 2005 Sorry, one more thing.. again not a big deal.. but it only hovers the alt text on the initial load of the page. After I click any link it no longer is available.. Strange stuff... but again, not a big deal since I am just after SEO results. James Scheller Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.