By audleman on
I've got a strange one. I've written my own node-blog.tpl.php to render my blog. At the end of each post (for teaser mode) is this code:
<div class="links">
<a href="<?php print $node->path?>" alt="Read post"><strong>Read Post</strong></a> |
<a href="<?php print $node->path?>" alt="Read comments">Comments (<?=$comment_count?>)</a>
</div>
In Firefox, the "Read More" and "Read Comments" links work perfectly. In IE, the a tag is empty, e.g. the output from print $node->path is empty.
To make things stranger, I currently have a print_r($node) statement at the end of my node. In Firefox I get the output, but in IE it doesn't show.
I thought all of this was server side. Does anybody have a clue why IE won't work with my $node?
Kevin
Comments
Update
Update: after giving it some time, the output from print_r($node) showed up in IE. However the hyperlinks that should point to $node->path still don't work.
Kevin
Caching
Sounds to me like this happened because IE was caching your site. Caching means that your browser remembers websites that you have been to before, and saves parts of them on your computer. This means that load time is faster after the first time you visit the site. Caching is great as a site user since load time is reduced, but it can be a little confusing while you are developing. (Apologies if you already know about caching)
What probably happened to you was that IE 'remembered' what that part of the page looked like and simply showed you what it 'remembered'. Eventually, it checked to see if that part of the page had been changed, and this is when you saw your changes take effect.
Sometimes, like this situation, you want to tell your browser to ignore its cache for a certain page. To do this in IE, reload the page while holding down the ctrl key. In Firefox, reload while holding down the shift key. For more information, read http://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache.
As for the broken hyperlinks, I need more information. Are they broken because they do not take you where you want them to go? Because they do not show up as hyperlinks? What does the html look like for your links? (IE: View >> Source, Firefox: View >> Page Source, if you didn't already know)
Links
ehart, thanks for the caching tip. I did know about it, but didn't know the Ctrl-click trick to getting IE to replace its cache.
With the hyperlinks, the deal is that this code in node-blog.tpl.php
is returning this HTML
whereas in Firefox it will be something like this
Here's the URL of the site if you want to see for yourself:
http://thegreatturning.net/gttest/blog
It appears as if the php code is returning something different based on the browser, which seems funny, but I can't figure out any other explanation.
thanks,
Kevin
Found a workaround
I replaced the variable $node->path with $node_url and got my URL's to work.
However a wierd thing with the caching. I had print_r($node) in my code, which puts a huge block of text in the page. I turned it off, and it immediately went away in Firefox. However in IE it didn't go away, even after I Ctrl-clicked the refresh button. I also went into Internet Settings and wiped all data. After 10 minutes, it suddenly vanished and the page was rendering the way it's supposed to.
The PHP code no longer had that print_r statement, so the server couldn't have been serving out that data. That would point to IE serving up a local copy, but how do I reconcile that with the fact that I did everything I could to force IE to reload?
Thanks,
Kevin
Hmm, I think that's beyond
Hmm, I think that's beyond what I know. Anyone else want to chime in?