Main Contents

iWeb and the XML tag.

Found, Talk September 1, 2008

If you – or somebody from your family – uses iWeb and dot-mac … well, dot-me, you’d usually would not encounter problems when uploading and publishing your site.

Also, if you upload your site to your paid host, the chances are that you do not run into a problem.

But, if you run your own server and possibly have modified the server configuration file – as we did with our Apache server, you might run into a big question mark when you upload the iWeb site and the only thing in return you get is a blank page staring at you.

As I own iWeb but don’t use it, this had never bothered me. Having family members which use our server and now are standing in queue to upload and publish, made it an emergency.

It did not take long to realize that the first line in the HTML files caused the problem. It is well known that IE6 will go into quirks mode if that XML tag precedes the DOCTYPE tag. And removing that tag made the pages render just fine. So far so good. Now I just have to have iWeb not add that tag in the first place and all would be good.

But after spending several hours with Goggle and tracking down how to modify the template files and trying to find which file needed to be adjusted to avoid this tag, I realized that I was trying to saddle the horse the wrong way around and avoiding the tag did not solve the situation but that the exact problem needed to be addressed.

If you’ve ever dabbled in some code, Javascript or PHP, you might have learned that if a web page renders white it means that some code could not execute. Thus it was quite clear, that obviously the server was trying to run some code and could not run it. It did take though a while until the coin dropped that the <? in the beginning is not only the opening tag for the XML call but also for PHP. With other words, our server interpreted this as PHP and tried running that language and got of course nowhere.

Usually a server is configured to read specific file types as PHP, such as .php or .phtml. I’m quite sure that at some point in the past when I did not realize this future ramification and with too little knowledge about code myself while learning PHP – probably introducing PHP code into some HTML files without ever changing the file type – I had told my husband to change the server config file to accept also HTML files as PHP, i.e. that PHP gets run on HTML files with the PHP tag. Dumb? Sure.

Lucky enough this problem was quick and easily solved. After removing the HTML as allowed PHP file type in the Apache config file, all was well and the iWeb sites now render without a problem.

If by any chance you are encountering the same problem but with a paid host, contact support and ask if they could change the server config file to not accept .html files as possible PHP container.

On another note: if you want to make life easy for people using iWeb on a non-dot-me server, there are two applications which make uploading newer files a breeze:

Both are donationware (if you do use it, remember to donate!!), and both work well with Easy iWeb Publisher offering more features, such as a progress bar and a log which allows you to track which files have been uploaded and which not. Both applications are smart enough to only upload newly modified files to the server.

 

11 Comments

  1. maka November 19, 2008 @ 6:58 am

    Thank you. helped alot…
    greetings from poland

  2. Cameron April 21, 2010 @ 4:55 pm

    A better solution may be to turn off the short_open_tag feature in your PHP configuration. Use of the short tag in PHP seems to be generally frowned upon and supposedly not to be supported in PHP 6.

    The Apache config to treat all HTML as PHP has its uses, so I’m not of the opinion it is a dumb thing to do.

  3. Marlyse Comte April 21, 2010 @ 5:19 pm

    Cameron, yes, you are right, those short tag in PHP is trouble (as I’ve learned since), and turning off these in the PHP config is – as I see it now – the best way to go.

    Out of curiosity: when would it make sense to use a .html file if it contains PHP and not just call it .php from the beginning?

  4. Cameron April 23, 2010 @ 11:10 am

    In our case, we are looking to transition an established site from .html to .php, specifically to use server side includes, so setting the server to run .html and .php files through PHP first would give us a low impact way of making that transition. Making the switch cold would affect search engine indexing, users’ personal bookmarks to pages, etc. While we could apply 301 redirects, that seems to get messy quickly.

  5. Marlyse Comte April 23, 2010 @ 11:15 am

    In this instance I totally agree,. Yes, this does make sense!

  6. Mike May 27, 2010 @ 10:54 am

    Both those apps don’t seem to fix the xml tag for me? What am I doing wrong?
    Thanks

  7. Marlyse Comte May 27, 2010 @ 11:06 am

    @Mike to which “apps” are you referring to?

  8. Mike May 27, 2010 @ 1:32 pm

    easy iweb publisher and w2w

  9. Marlyse Comte May 27, 2010 @ 2:03 pm

    @Mike : ah, I understand. These apps have nothing to do with the XML tagging problem, as you will see if you read the whole article. I am referencing those 2 apps as:

    On another note…

  10. Mike May 27, 2010 @ 7:55 pm

    sorry is there a easy way to remove xml tags is the server can’t be changed?

  11. Marlyse Comte May 27, 2010 @ 10:22 pm

    @Mike – got it.

    You can control it also via an .htaccess file which you need to put into the root of your website (do a Google search to see what an .htaccess file is and what it does and how to create one). The important point is that you need to set php_flag short_open_tag off – or – if running PHP5 on your server you need to write php5_flag short_open_tag off.

    If you are able to create and add an .htaccess file to your website directory, you will also be able to handle other, possible strange characters you have seen due to using iWeb.

    Add the following lines to your .htaccess file:

    php_flag short_open_tag off
    AddDefaultCharset UTF-8
    AddCharset UTF-8 .html
    AddDefaultCharset Off

    Here is the link to another site which discusses iWeb and the XML tag which is very good.

    The only other option which you have is to – on your drive – do a search in the websites directory and all its files for the tag and then remove it (and remember to remove the corresponding closing tag too), but this is not the smart way to go and most likely with new pages in the future created has to be done again and again plus be managed and it is really NOT quick and easy and quite likely you’ll forget at some point and then the site will be messed up.

    Good luck!

Leave a comment


Google Analytics Alternative