php includes and Internet Explorer

  slightlymad 02:35 19 Sep 2009

I'm building a large site for a client and I'm using php includes for the header and the two navigation menus (that's as far as my knowledge of php goes, incidentally).

The site displays perfectly in Firefox but in IE nothing beyond the header shows up. If I remove the includes everything else displays just fine.

Any ideas, please?

click here

  Taran 07:43 19 Sep 2009

It's difficult to say since all we can see is the HTML output that your PHP file(s) produce.

First port of call would be to remove the Flash code - a glance at the page source reveals that you are referencing a very old version of Flash, and it's a non-standard loader script that mdoern versions of IE can't cope with.

I saved a local copy of your page, removed all of the Flash <object> code and it rendered all other content in Internet Explorer.

That said, it mangled it, so there's something else going on as well, but you should be able to more easily track that down without the difficulties of rendering the page to begin with. I suspect legacy CSS code or perhaps it would be worth unlinking the various JavaScript library references and test it again, or remove the CSS links completely, then do the same.

That should give you a bare-bones, PHP-produced-html-only view with no eye-candy to speak of.

My first suspicion is that the Flash loader code is throwing a hissy fit, followed by bugs in JavaScript and/or CSS.

Since you are using Project PVII it is a fair assumption that you are using Dreamweaver as your editor of choice. Dreamweaver versions after MX all have various browser testing and code checking tools built in, and you get more of them the more current your version of Dreamweaver.

You might want to invest some time in running those built-in checks, which should allow you to get to the bottom of some or even all of your page problems in short order.

You might also try hard coding the full link into every referenced file, along the lines of http : // yoursite / location_and_full_name_of_CSS/JavaScript

Can't offer anything else until the coffee kicks in, but that Flash <object> code stinks...

  slightlymad 12:34 19 Sep 2009

Thank you so much, Taran - you've been to a lot of trouble on my behalf and I appreciate it.

I used TopStyle Pro for my coding and Dreamweaver CS4 to for the Project VII extensions and to insert the swf file. It's surprising that the latest version of Dreamweaver still produces rubbish code for Flash insertion, and I've removed this. I found an article on "How to insert Flash correctly" and I'm now using this code:

<!--[if !IE]> -->
<object type="application/x-shockwave-flash"
data="logo.swf" width="240" height="130">
<!-- <![endif]-->
<!--[if IE]>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="click here"
width="300" height="135">
<param name="movie" value="logo.swf" />
<param name="loop" value="false" />
<param name="menu" value="false" />
<p><strong>Content on this page requires a newer version of Adobe Flash Player:</strong></p>
<p><a href="click here"><img src="click here" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
<!-- <![endif]-->

click here for article.

If recommend a better alternative then please can you let me know?

The page now displays properly in IE7 but I can't test in IE8 (on another computer that refuses to connect to the Internet at the moment). I'm concerned about the mangled code that you saw so could you please check again for me?

Also if I delete the Flash file I get the alternative content message - about requiring a newer version of Flash - in Firefox but not IE7; can you shed any light on this?

Thanks again for your help.

  Taran 14:20 19 Sep 2009

There are a number of potential solutions and none of them are particularly elegant, as you have already found.

You can draw your own conclusions from this but the bottom line is that Flash content, even in this day and age, is to be avoided due to the many cross-browser and code-validating issues it presents.

As long as web standards are still unsupported in full by all mainstream browsers web developers don't stand a cat in hell's chance.

Browsers suck (mostly) and they all have serious issues - the issues just tend to be different from browser to browser, making it even more entertaining and time wasting to find solutions to problems that shouldn't be an issue to begin with.

Given that your Flash content only moves a small portion of its content on the screen I'd be asking whether I need to actually use it to begin with.

The human eye is lazy and naturally attracted to movement. I'd be asking myself questions if I was expecting my sites to draw the visitors eye to a page element that serves no function in terms of delivering anything of worth. I'm not trying to sound cruel with that - it's just that the Flash banner is just that. Effectively its a logo, but a part of it moves brielfy.

If you went with a static PNG or JPG we wouldn't be discussing the whole thing and you wouldn't have the issues you have now...

Just my thoughts - Flash is great for user interfaces on e-learning sites, for example, that aren't going to be delivered to challenging users. Beyond that I haven't much time for it to be honest, and you are experiencing at least some of the rationale behind that. If browsers supported it thoroughly I'd change that stance.

As an aside, I'd be more concerned if I was you about how your navigation degrades without JavaScript.

Sorry if any of this sounds completely negative, but I've lost count of the troubleshooting hours spent debugging sites over the years where code should have worked but, for one reason/browser or another, things didn't go as planned.

I'm a great believer in keeping it simple, which ensures that things work on every mainstream browser.

  Taran 14:27 19 Sep 2009

I'd meant to add that you might want to look at dynamically generated drop down menu lists/options to build your navigation.

They can be made to degrade very, very well, and they build your navigation structure automagically whenever new content is added.

Frankly, your opening line "I'm building a large site for a client" suggests a likely candidate for using a CMS to manage the whole thing. No disrespect intended, but unless you have a really good grasp on database design and use for managing large volume content, rolling out a client site is not the time to learn.

For all I know you may be a dab hand here, so my apologies if this comes across patronising in any way, but a good CMS makes managing large amounts of information and complex link structures a doddle over the longer term.

I've written a few CMS's from the ground up and used lots of others and, in the right circumstances, they save you and your client hour upon hour upon hour.

Just a thought...

  slightlymad 16:12 19 Sep 2009

I agree with everything you say, Taran, and despite appearances to the contrary I too am a coding/accessibility purist... I usually avoid JavaScript and Flash unless absolutely necessary.

The Flash header certainly isn't necessary - a 3-second affair that you miss if you blink, weighing in at 244kb when a GIF would be a tiny fraction of the size and do away with scripts and display issues.

So why did I do it? Because I wanted to know how. And then I wanted to know why it didn't work…

As for the dynamically generated drop-down menu that you mention, I'm very interested in this - can you point me in the right direction, please? I paid Project VII just short of £90 for their "Megavator", feeling safe in my choice by their assurance that it would degrade gracefully. The vertical menu is fine, but the horizontal one isn't pretty when I disable Javascript. I may not change it as my clients really like it, and besides, it would HURT, having paid all that money and spending hours styling the wretched thing…

Content management - I'm certainly not a dab hand and again what you say is of great interest. I'd like to get in touch with you privately for future projects if that's OK with you (I know this wasn't your intent, I hasten to add). Having said that, the reason that I purchased DW CS4 is that Adobe is now offering "InContext Editing", not yet available in the UK. There will be a monthly fee, however, as yet undetermined whilst it's in trial mode.

Meanwhile, my current clients aren't interested in CMS. When I said that it would be large site, I meant 32 pages, all static and unlikely to be edited often. I built their current site two years ago and have made only a few edits in that time, certainly cheaper than configuring a CMS. I'm now redesigning the site in order to accommodate their expanding services.

One last thing - did you check the page in IE8 for me?


  slightlymad 17:50 19 Sep 2009

My connection is back. I just checked the page in IE8 and it's lookin' good - thanks for finding the cause, Taran. I WILL be getting rid of the Flash when the site goes live. I'll tick "resolved" but I'd still like to hear about your dynamic menu, please.

  Taran 20:36 19 Sep 2009

Dynamically generated navigation is usually done in two ways:

1. Call the link/content information for the page(s) from a database

2. Scan a directory for files and create a list of links to them

Unless you are running an underying database option 1 probably won't fly.

If you are running an underlying database to store content (it sounds as though you aren't) then this is drop dead easy.

Your PHP calls the link name from the relevant part of the database and displays that page content when clicked.

The other way is to manually create index.php, about_us.php, contact_us.php etc and have your PHP header include the relevant code to scan the web root and build navigation accordingly.

A more advanced version would scan the parent directory first and then build child pages from sub-directories.


Assume the web root has about_us.php

Now assume that the sub-directory of your web root called about_us has the following child pages:





Your header file could include the required code to build parent level links from any PHP file in the web root and then go looking for child pages of the parent links in the relevant sub-directory.

Any new page you add to any directory will be listed automagically by the PHP that scans and lists files as hyperlinks.

There's a bit more to it than that, but the above is a grossly oversimplified version of a couple of methods of achieving this. A bit of Googling should point you down the right path, and you can exclude pages from the autoscanning process in a number of ways, including the use of an .htaccess file or by hard coding an exclusion list within your PHP.

Your site seems to render OK in IE8. I've not had any of the Macs running today so I haven't checked it on Safari or Camino.

For future reference you should bookmark and use the excellent (and free) website Browsershots click here

You can ask the site to check your test URL(s) in any of the browsers, versions and operating systems listed, with and without JavaScript and Flash support.

It's an excellent alternative to the paid-for Browsercam service, provided you don't expect instant returns on your query.

Finally, on this topic "I'd like to get in touch with you privately for future projects if that's OK with you", I will have to respectfully decline.

Problems and issues can be aired in this and other forums and any solutions offered have the possibility of benefitting more than one person.

I am a single parent of a two-and-a-half year old daughter and despite 'retiring' a while ago I seem to be busier now more than ever and the projects I am involved in demand a lot of input and travel.

I have been with this forum since its inception and regularly drift away (and back again) due to workload and life in general, but there is a wealth of knowledge freely offered by many here and you usually stand a better chance asking many as opposed to just one.

I hope you understand.

Good luck with this and any future projects.

Kind regards,


  slightlymad 01:15 21 Sep 2009

Sorry, Taran - I forgot that e-mail notifications are switched off when you mark as 'resolved' so I've only just seen your response.

Thanks for the very useful info - I have a lot to learn and I'll certainly be looking into your suggestions. I've created a simple database for another website so I understand what you're saying, I just need to pluck up the courage to go to the next level.

As for my getting in touch with you, apologies for the wording in my previous post - I certainly didn't intend to consult you privately for advice - it simply occurred to me that since you evidently do programming for a living that I might have need of your services on a professional basis. It's good to know like-minded thinkers and you're clearly good at what you do, but I fully understand if you're too busy.

Thanks again for all your help, and I'm sure I'll be back for more...

Best wishes,

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Best Black Friday Deals 2017

How modern book design was influenced by illustrated manuscripts

Best Black Friday Apple Deals 2017

Les meilleurs logiciels de montage vidéo gratuits (en 2017)