shasidi Posted July 15, 2007 Share Posted July 15, 2007 Hi all, I would like to be my category name inside the <h1> tags so it can increase the position in google in the future, I just need to put <h1> tag somewhere below but I don't speak php so much... I know that I need to embed h1 tag somewhere outside of that code written in red. Help me please, if you know. I have following code : // display category name $categories_string .= $tree[$counter]['name']; $categories_string .= '</a><br><br class=px4></td></tr>'; }else{ $categories_string .= '<tr><td>'; for($i=0;$i<$tree[$counter]['level'];$i++) $categories_string .= ' '; $categories_string .= ' - <a class=ml1 href='; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link('index.php', $cPath_new) . '>'; Best regards Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted July 15, 2007 Share Posted July 15, 2007 2 comments: 1) we need a bit more code, where the linking starts 2) you should only ever have 1 h1 tag/page ... using it on every cat in the cat box will hurt you, not help, so a h2 tag would be a an option 3) depending on how many cats you have, I would not even use any h tags in the cat box, but keep those tags for the main page info :-) 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 ... Link to comment Share on other sites More sharing options...
shasidi Posted July 15, 2007 Author Share Posted July 15, 2007 2 comments: 1) we need a bit more code, where the linking starts 2) you should only ever have 1 h1 tag/page ... using it on every cat in the cat box will hurt you, not help, so a h2 tag would be a an option 3) depending on how many cats you have, I would not even use any h tags in the cat box, but keep those tags for the main page info thanks for reply Monika, Yes you right, I should use h2 tag instead... And I am using a template, not the original osCommerce. So here is the code of the header.php : <?php /* $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ // check if the 'install' directory exists, and warn of its existence if (WARN_INSTALL_EXISTENCE == 'true') { if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) { $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning'); } } // check if the configure.php file is writeable if (WARN_CONFIG_WRITEABLE == 'true') { if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) { $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning'); } } // check if the session folder is writeable if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') { if (STORE_SESSIONS == '') { if (!is_dir(tep_session_save_path())) { $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning'); } elseif (!is_writeable(tep_session_save_path())) { $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning'); } } } // check session.auto_start is disabled if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) { if (ini_get('session.auto_start') == '1') { $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning'); } } if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) { if (!is_dir(DIR_FS_DOWNLOAD)) { $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning'); } } if ($messageStack->size('header') > 0) { echo $messageStack->output('header'); } ?> <table cellspacing=0 cellpadding=0 width=736 align=center> <tr><td> <table cellspacing=0 cellpadding=0> <tr><td height=13 colspan=6></td></tr> <tr><td><a href=<?=tep_href_link('index.php')?>><img src=images/m01.gif width=251 height=70 border=0></a></td> <td width=325 height=70> <table cellspacing=0 cellpadding=0 width=250 align=center> <tr><td width="158" class=cy> <? echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' .BOX_HEADING_LANGUAGES . '</a>' ?></td> </tr> <tr><td height=8></td></tr> <tr><td> <? // LANGUAGES if (!isset($lng) || (isset($lng) && !is_object($lng))) { include(DIR_WS_CLASSES . 'language.php'); $lng = new language; } $languages_string = ''; reset($lng->catalog_languages); while (list($key, $value) = each($lng->catalog_languages)) { $languages_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a> '; } echo $languages_string; ?> </td></tr> </table> </td> <td><img src=images/m17.gif width=1 height=70></td> <td width=159 height=70> <table cellspacing=0 cellpadding=0 align=center width=133> <tr><td height=10 colspan=2></td></tr> <tr><td align=center><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/m03.gif width=33 height=33 border=0></a></td><td class=cy><? echo '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . BOX_HEADING_SHOPPING_CART . '</a>' ?></td></tr> <tr><td height=3 colspan=2></td></tr> <tr><td colspan=2><b><a href=<?=tep_href_link('shopping_cart.php')?> class=ml> <?=$cart->count_contents()?> <? echo '<a class=ml href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' .BOX_SHOPPING_CART_STATUS . '</a>' ?> </a></b></a></b></td> </tr> <tr><td height=8 colspan=2></td></tr> </table> </td></tr> </table> <table cellspacing=0 cellpadding=0> <tr><td width=199 valign=top> <table cellspacing=0 cellpadding=0> <tr><td colspan="2"><img src=images/m07.gif width=199 height=13></td></tr> <tr><td height="29" width="1"><img src=images/m263.gif width=1 height=29></td> <td width="198" td class="menu"><? echo '<img src=images/menu.gif width=7 height=10 align=absmiddle> <a href="' . tep_href_link(FILENAME_DEFAULT) . '">' .HEADER_TITLE_CATALOG . '</a>' ?></td> </tr> <tr><td height="25" width="1"><img src=images/m263.gif width=1 height=25></td> <td width="198" td class="menu"> <? echo '<img src=images/menu.gif width=7 height=10 align=absmiddle> <a href="' . tep_href_link(FILENAME_PRODUCTS_NEW) . '">'.BOX_HEADING_WHATS_NEW. '</a>' ?></td> </tr> <tr><td height="24" width="1"><img src=images/m263.gif width=1 height=24></td> <td width="198" td class="menu"> <? echo '<img src=images/menu.gif width=7 height=10 align=absmiddle> <a href="' . tep_href_link(FILENAME_LOGIN) . '">'.HEADER_TITLE_MY_ACCOUNT. '</a>' ?></td> </tr> <tr><td height="24" width="1"><img src=images/m263.gif width=1 height=24></td> <td width="198" td class="menu"> <? echo '<img src=images/menu.gif width=7 height=10 align=absmiddle> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">'.BOX_HEADING_SHOPPING_CART. '</a>' ?></td> </tr> <tr><td height="31" width="1"><img src=images/m263.gif width=1 height=31></td> <td width="198" td class="menu"> <? echo '<img src=images/menu.gif width=7 height=10 align=absmiddle> <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING) . '">'.HEADER_TITLE_CHECKOUT. '</a>' ?></td> </tr> <tr><td colspan="2"><img src=images/m15.gif width=199 height=18></td></tr> </table> </td> <td valign=top><img src=images/m08.jpg width=203 height=164><img src=images/m09.jpg width=174 height=164></td> <td> <table cellspacing=0 cellpadding=0 height=164 border=0> <tr><td><img src=images/m10.gif width=160 height=16></td></tr> <tr><td class=bg> <table cellspacing=0 cellpadding=0 width=127 align=center> <tr><td> <? echo '<tr><td colspan=2><img src=images/m12.gif width=3 height=3 align=absmiddle> <a href="' . tep_href_link(FILENAME_SPECIALS) . '">' . BOX_HEADING_SPECIALS . '</a></td></tr>' ?> </td></tr> <tr><td height=2></td></tr> <tr><td> <? echo '<tr><td colspan=2><img src=images/m12.gif width=3 height=3 align=absmiddle> <a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a></td></tr>' ?></td></tr> <tr><td height=2></td></tr> <tr><td><? echo '<tr><td colspan=2><img src=images/m12.gif width=3 height=3 align=absmiddle> <a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a></td></tr>' ?> </td></tr> <tr><td height=2></td></tr> <tr><td><? echo '<tr><td colspan=2><img src=images/m12.gif width=3 height=3 align=absmiddle> <a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT) . '">' . HEADER_TITLE_CREATE_ACCOUNT . '</a></td></tr>' ?> </td></tr> <tr><td height=2></td></tr> <tr><td><? echo '<tr><td colspan=2><img src=images/m12.gif width=3 height=3 align=absmiddle> <a href="' . tep_href_link(FILENAME_LOGIN) . '">' . HEADER_TITLE_LOGIN . '</a></td></tr>' ?> </td></tr> <tr><td></td></tr> <tr><td><img src=images/m14.gif width=127 height=1></td></tr> <tr><td height=4></td></tr> <tr><td><b><font color=#000000><? echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' .BOX_HEADING_CURRENCIES . '</a>' ?> </font></b></td></tr> <tr><td height=8></td></tr> <tr><td> <? // CURRENCIES echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'); reset($currencies->currencies); $currencies_array = array(); while (list($key, $value) = each($currencies->currencies)) { $currencies_array[] = array('id' => $key, 'text' => $value['title']); } $hidden_get_variables = ''; reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) { $hidden_get_variables .= tep_draw_hidden_field($key, $value); } } echo tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id(); echo '</form>'; ?> </td></tr> </table> </td></tr> <tr><td><img src=images/m16.gif width=160 height=18></td></tr> </table> </td></tr> </table> <table cellspacing=0 cellpadding=0> <tr><td colspan=3 height=3></td></tr> <tr><td width=207 valign=top> <table cellspacing=0 cellpadding=0> <tr><td><img src=images/m24.gif width=207 height=40></td></tr> <tr><td class=bg1> <table cellspacing=0 cellpadding=0 width=167 align=center> <tr><td height=18></td></tr> <? // ---- CATEGORIES function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; if(!$tree[$counter]['level']){ $categories_string .= $categories_string ? '<tr><td><img src=images/m26.gif width=167 height=1><br><br class=px2></td></tr>' : ''; $categories_string .= '<tr><td><img src=images/m25.gif width=5 height=5 align=absmiddle> <a class=ml1 href='; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link('index.php', $cPath_new) . '>'; // display category name $categories_string .= $tree[$counter]['name']; $categories_string .= '</a><br><br class=px4></td></tr>'; }else{ $categories_string .= '<tr><td>'; for($i=0;$i<$tree[$counter]['level'];$i++) $categories_string .= ' '; $categories_string .= ' - <a class=ml1 href='; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link('index.php', $cPath_new) . '>'; // display category name $categories_string .= $tree[$counter]['name']; $categories_string .= '</a><br><br class=px4></td></tr>'; } if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } } define(TABLE_CATEGORIES, "categories"); define(TABLE_CATEGORIES_DESCRIPTION, "categories_description"); $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 ($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; } } } $categories_string .= ''; tep_show_category($first_element); $categories_string .= ''; echo $categories_string; ?> <tr><td height=5></td></tr> </table> </td></tr> <tr><td><img src=images/m27.gif width=207 height=6></td></tr> <tr><td height=3></td></tr> </table> <table cellspacing=0 cellpadding=0> <tr><td><img src=images/m28.gif width=207 height=40></td></tr> <tr><td class=bg1> <table cellspacing=0 cellpadding=0 width=175 align=center border=0> <? echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); echo '<tr><td height=17 colspan=2></td></tr> <tr><td valign=top align=right>'.tep_draw_input_field('keywords', '', 'size="20" maxlength="30" class=go') . ' ' . tep_hide_session_id() . '</td><td valign=top align=left> <input type=image src=images/m30.gif width=31 height=21></td></tr> <tr><td height=8 colspan=2></td></tr> <tr><td colspan=2><a class=ml2 href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a></td></tr> <tr><td height=8 colspan=2></td></tr> </form>'; ?> </table> </td></tr> <tr><td><img src=images/m27.gif width=207 height=6></td></tr> </table> </td> <td width=3 valign=top></td> <td width=526 valign=top> Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted July 15, 2007 Share Posted July 15, 2007 find this // display category name $categories_string .= $tree[$counter]['name']; change to this (you can do the style for changing the font size one time directly here, or more elegantly in the stylesheet) // display category name $categories_string .= '<h2 style="font-size:11px; line-height: 11px;">' . $tree[$counter]['name'] . '</h2>'; add this to your stylesheet h2 { font-family: Verdana, Arial, sans-serif; font-size: 10px; display:inline; } keep me posted! :-) 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 ... Link to comment Share on other sites More sharing options...
shasidi Posted July 15, 2007 Author Share Posted July 15, 2007 find this // display category name $categories_string .= $tree[$counter]['name']; change to this (you can do the style for changing the font size one time directly here, or more elegantly in the stylesheet) // display category name $categories_string .= '<h2 style="font-size:11px; line-height: 11px;">' . $tree[$counter]['name'] . '</h2>'; add this to your stylesheet h2 { font-family: Verdana, Arial, sans-serif; font-size: 10px; display:inline; } keep me posted! Great help Monika, code works well :thumbsup: vielen Dank fuer Hilfe! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.