Hi,

I'm having a classic 'doesn't work in IE but works in FF' problem.

I have a site http://learn-croatian.com/apdejt and I wanted to make it easier for me to update metas in all pages with help from php. I'd change the php variables in a central file which is included in every page. Here's what I did:

<?php include ("meta.txt"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title><?php echo "$naslov"; ?>Homepage</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo "$opis"; ?>" />
<meta name="keywords" content="<?php echo "$kljucne"; ?>"/>
<meta name="author" content="<?php echo "$autor"; ?>" />
<link rel="stylesheet" type="text/css" href="style.css" />
<meta name="copyright" content="Learn-Croatian.com" />
<meta http-equiv="content-language" content="en, hr" />

<!--[if IE]>
<style type="text/css">
* html .ex{padding-bottom:32767px;margin-bottom:-32767px;}
</style>
<![endif]-->
</head>

Here is the meta.txt file:

<?php
$opis="Learn-Croatian.com is the site for grasping the basics of the Croatian language for free!";
$kljucne="horvatsko, chorvatsko, book, croatian, lessons, lesson, adjectives, verbs, nouns, pronouns, croatia, language, hrvatski, hrvatska, croatian, jezik, learn, free, phrasebook, phrases, recordings, translations, tourist, tourism, holidays, vacations, trips, istria, istra, slavonija, slavonia, dalmatia, dalmacija, zagreb, no, charge, online, trips, vacations, holidays, kroatiska";
$naslov="Learn Croatian for free | ";
$autor="Tomislav - contact@learn-croatian.com";
?>

Well, it doesn't work in IE 6. Please hit the link I gave above with FF and IE both. You'll see what I'm talking about. However, if I don't use the include command and just insert the code from the meta.txt file everything works fine (except the fact that the picture in the header is pushed down too much which can be seen with IE even now). But if I do that, I'll have to modify each page manually when I want to change the metas one day.

Please help!

Member Avatar for Rhyan

Hi there,

I did not notice any problem here. Please note code as rendered from IE, FF and Opera 9


Opera:
<meta name="description" content="Learn-Croatian.com is the site for grasping the basics of the Croatian language for free!" />
<meta name="keywords" content="horvatsko, chorvatsko, book, croatian, lessons, lesson, adjectives, verbs, nouns, pronouns, croatia, language, hrvatski, hrvatska, croatian, jezik, learn, free, phrasebook, phrases, recordings, translations, tourist, tourism, holidays, vacations, trips, istria, istra, slavonija, slavonia, dalmatia, dalmacija, zagreb, no, charge, online, trips, vacations, holidays, kroatiska"/>
<meta name="author" content="Tomislav - contact@learn-croatian.com" />
<link rel="stylesheet" type="text/css" href="style.css" />
<meta name="copyright" content="Learn-Croatian.com" />
<meta http-equiv="content-language" content="en, hr" />

IE 6 winxpsp2:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="Learn-Croatian.com is the site for grasping the basics of the Croatian language for free!" />
<meta name="keywords" content="horvatsko, chorvatsko, book, croatian, lessons, lesson, adjectives, verbs, nouns, pronouns, croatia, language, hrvatski, hrvatska, croatian, jezik, learn, free, phrasebook, phrases, recordings, translations, tourist, tourism, holidays, vacations, trips, istria, istra, slavonija, slavonia, dalmatia, dalmacija, zagreb, no, charge, online, trips, vacations, holidays, kroatiska"/>
<meta name="author" content="Tomislav - contact@learn-croatian.com" />
<link rel="stylesheet" type="text/css" href="style.css" />
<meta name="copyright" content="Learn-Croatian.com" />
<meta http-equiv="content-language" content="en, hr" />

FFOX 2.0.2:

<meta http-equiv="content-type" content="text/html; charset=windows-1250" />
<meta name="description" content="Learn-Croatian.com is the site for grasping the basics of the Croatian language " />
<meta name="keywords" content="horvatsko, chorvatsko, book, croatian, lessons, lesson, adjectives, verbs, nouns, pronouns, croatia, language, hrvatski, hrvatska, croatian, jezik, learn, free, phrasebook, phrases, recordings, translations, tourist, tourism, holidays, vacations, trips, istria, istra, slavonija, slavonia, dalmatia, dalmacija, zagreb, no, charge, online" />
<meta name="author" content="Tomislav - nomad2389@gmail.com" />
<link rel="stylesheet" type="text/css" href="style.css" />
<meta name="copyright" content="Learn-Croatian.com" />Are you sure you were looking the source of the same file? It seems OK.
Note that normally it is the PHP parser that passes the info to the browser, so if any problem occurs it should be php / serverside related, rather than a browser problem.

Cheers!

Member Avatar for Rhyan

p.s. Do you have some code prior the DOCTYPE declaration.

There is some symbol there, that causes the "pushing down" of the picture. It is a line break, or a dot, or something like that, so it distorts the code a bit.

Yes I do have a piece of code before DOCTYPE, I've said so in my initial post. However, in Firefox it looks fine. I don't know why everything is ok in your IE, because in mine it looks like this (the third column starts after the fold):

[IMG]http://img.photobucket.com/albums/v163/Poslanik/Svasta/skrini.jpg[/IMG]

The code you pasted looks fine (the metas are ok and everything) but I can't get it to work in IE. Could you please take a screenshot of the site while viewing it with IE?

P.S. I just had my friend take a screenshot of the site in IE and it came out same as mine. He's having problems too.

Does anyone know why including files with php screwes up pages in IE?

Member Avatar for Rhyan

P.S. I just had my friend take a screenshot of the site in IE and it came out same as mine. He's having problems too.

Does anyone know why including files with php screwes up pages in IE?

Hm... I saw what you mean - I have opened http://learn-croatian.com/ and it is OK.

Now, what I have noticed is that there are some invalid characters in your code on several places. But I doubt that it is the main reason for having it all distorted like that.

I see you have some number of improperly closed divs, that may be the reason for such distortion. I will take a closer look, and will advise, meantime, do you use a tool like dreamweaver, or something else to edit the page?

No, I code in notepad. You opened the wrong address :) you need to open the apdejt folder.

P.S. I received your PM, we'll talk over ICQ.

Well, one thing I've noticed with PHP & IE... (Well, to be more precise: the HTML that results in our use of PHP)... is....
The first line actually sends a newline to the browser before continuing to the DOCTYPE line. If we put a <? php line here ?>we might want to continue the rest of the html directly after the php closing since sometimes a newline throws off a structured graphic design.

mediaphyte dot com

I saved the files in UTF without BOM and everything's working fine. Thanks anyway.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.