[56K WARN] Firefox: extra <a> tags [SOLVED]
Posted: Thu Sep 27, 2007 4:44 pm
feyd | Please use
and the resulting code looks like this when it renders correctly (paste from FireBug):
Now, when the tab is rendered incorrectly, the code looks like:
and I can't for the life of me figure out why it only sometimes comes across like that. By the way, the "Links" tab is not the only one treated like this; Links, News, Products, and Search tabs can potentially be victimized like this. I can't seem to nail down a pattern to the whole thing.
Too see what I'm talking about, just click back and forth across the tabs. I don't think this is a cache issue, since I've cleared it many times, plus I've seen this on other PCs.
EDIT: I missed a line of code originally in the "rendered incorrectly" section: <a class="tab" href="links.php">Links</a> was missing.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
OK. I can't figure out if this is a PHP or Firefox issue, but here goes.
My system info is: Windows XP Pro SP2 with Firefox 2.0.0.7 and the issue seems to only happen in FF2, never in IE6 or IE7. The web site I'm having trouble with is [url]http://www.envisionamerica.com/[/url] and involves the horizontal navigation tabs you'll see once you get past the welcome page. On a given page, the tabs should look basically like this:
[img]http://www.envisionamerica.com/images/misc/X_CSStabs_Correct.jpg[/img]
(The white tab with blue text indicates the page the browser is on and is non-clickable.)
Sometimes, however, a tab will be coded in a way that makes it render like the "Links" tab seen here (which reflects the CSS for the global a tag):
[img]http://www.envisionamerica.com/images/misc/X_CSStabs_Links.jpg[/img]
These tabs are part of the file eva_header.php which is pulled in with PHP's include_once funtion on every page. I have been using the FF extension FireBug to compare things, and I've found something extremely odd. The PHP for rendering that "Links" tab is:Code: Select all
// the Links tab
$func_word='Links'; // this is the parameter passed to the functions; must be unique in this code page
$tab_word='Links'; // this is the word that appears on the tab in the browser page's navigation row
if (substr($_SERVER['PHP_SELF'], -9) == 'links.php')
{ echo '
<div id="tab'.$func_word.'" class="tabLocal">
<div class="tabLeftLocal"></div>
<div class="tabTextLocal">'.$tab_word.'</div>
<div class="tabRightLocal"></div>
</div id="_tab'.$func_word.'">
';
} else {
echo '
<div id="tab'.$func_word.'" class="tabOut" onmouseover="func_tabsOver(\''.$func_word.'\');" onmouseout="func_tabsOut(\''.$func_word.'\');">
<a href="'.$crumbs.'links.php" class="tab">
<div id="tab'.$func_word.'Left" class="tabLeftOut"></div>
<div id="tab'.$func_word.'Text" class="tabTextOut">'.$tab_word.'</div>
<div id="tab'.$func_word.'Right" class="tabRightOut"></div>
</a>
</div id="_tab'.$func_word.'">
';
}Code: Select all
<div id="tabLinks" class="tabOut" onmouseout="func_tabsOut('Links');" onmouseover="func_tabsOver('Links');">
<a class="tab" href="links.php">
<div id="tabLinksLeft" class="tabLeftOut"/>
<div id="tabLinksText" class="tabTextOut">Links</div>
<div id="tabLinksRight" class="tabRightOut"/>
</a>
</div>Code: Select all
<div id="tabLinks" class="tabOut" onmouseout="func_tabsOut('Links');" onmouseover="func_tabsOver('Links');">
<a class="tab" href="links.php"/>
<div id="tabLinksLeft" class="tabLeftOut"/>
<a class="tab" href="links.php"/>
<div id="tabLinksText" class="tabTextOut">
<a class="tab" href="links.php">Links</a>
</div>
<a class="tab" href="links.php"/>
<div id="tabLinksRight" class="tabRightOut"/>
</div>Too see what I'm talking about, just click back and forth across the tabs. I don't think this is a cache issue, since I've cleared it many times, plus I've seen this on other PCs.
EDIT: I missed a line of code originally in the "rendered incorrectly" section: <a class="tab" href="links.php">Links</a> was missing.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]