martin mosley Posted January 15, 2008 Share Posted January 15, 2008 I am new to web site development and to php. Over the past few weeks I have worked hard to learn and written some script which looks ok (to me anyway) in ie7. Following comments from users I installed firefox and looked at the page on there. Guess what.... the page that I was so proud of looked hopeless!! I can see nothing I have done wrong, though how would I know? All I can say is that the confidence I was developing has taken one big hit, and I now realise that I know nothing after all. Would anyone mind looking at the attached code and telling me what I need to correct. Also if you have advice regarding the design of the page, any comments would be welcome. The page can be seen at http://www.mosleyfamilies.net/histories/alfred.php The script is attached Many thanks in advance for any help and advice Martin [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/ Share on other sites More sharing options...
sKunKbad Posted January 15, 2008 Share Posted January 15, 2008 Validating your HTML is a good start. Your validation currently is -> Result: 179 errors / 0 warnings. Here are the details: line 32 column 7 - Error: document type does not allow element "UL" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag line 34 column 70 - Error: document type does not allow element "BR" here; assuming missing "LI" start-tag line 66 column 63 - Error: document type does not allow element "TABLE" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag line 114 column 17 - Error: document type does not allow element "P" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag line 116 column 54 - Error: document type does not allow element "P" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag line 125 column 17 - Error: document type does not allow element "TABLE" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag line 140 column 25 - Error: document type does not allow element "DIV" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag line 145 column 6 - Error: an attribute specification must start with a name or name token line 145 column 6 - Error: element "ALIGN" undefined line 161 column 4 - Error: document type does not allow element "UL" here line 161 column 11 - Error: an attribute specification must start with a name or name token line 161 column 11 - Error: document type does not allow element "STYLE" here line 166 column 83 - Error: end tag for "STYLE" omitted, but its declaration does not permit this line 161 column 5 - Info: start tag was here line 166 column 83 - Error: "UL" not finished but containing element ended line 166 column 83 - Error: end tag for "UL" omitted, but its declaration does not permit this line 161 column 1 - Info: start tag was here line 166 column 83 - Error: "TABLE" not finished but containing element ended line 166 column 83 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 160 column 6 - Info: start tag was here line 166 column 83 - Error: end tag for "DIV" omitted, but its declaration does not permit this line 140 column 6 - Info: start tag was here line 190 column 68 - Error: document type does not allow element "A" here line 193 column 10 - Error: end tag for element "SPAN" which is not open line 194 column 8 - Error: end tag for "TABLE" which is not finished line 207 column 57 - Error: document type does not allow element "A" here line 211 column 8 - Error: end tag for element "SPAN" which is not open line 212 column 8 - Error: end tag for "TABLE" which is not finished line 237 column 348 - Error: end tag for "B" omitted, but its declaration does not permit this line 237 column 22 - Info: start tag was here line 237 column 352 - Error: end tag for element "B" which is not open line 244 column 64 - Error: document type does not allow element "UL" here; missing one of "TH", "TD" start-tag line 246 column 49 - Error: "TABLE" is not a member of a group specified for any attribute line 246 column 55 - Error: "WIDTH" is not a member of a group specified for any attribute line 246 column 55 - Error: "90" is not a member of a group specified for any attribute line 247 column 76 - Error: document type does not allow element "TABLE" here line 248 column 49 - Error: document type does not allow element "SPAN" here; assuming missing "CAPTION" start-tag line 251 column 27 - Error: document type does not allow element "TR" here line 253 column 34 - Error: document type does not allow element "TR" here line 256 column 34 - Error: document type does not allow element "TR" here line 256 column 193 - Error: delimiter """ invalid: only S separators and TAGC allowed here line 258 column 34 - Error: document type does not allow element "TR" here line 260 column 34 - Error: document type does not allow element "TR" here line 262 column 34 - Error: document type does not allow element "TR" here line 264 column 34 - Error: document type does not allow element "TR" here line 266 column 34 - Error: document type does not allow element "TR" here line 268 column 34 - Error: document type does not allow element "TR" here line 270 column 34 - Error: document type does not allow element "TR" here line 276 column 33 - Error: document type does not allow element "TR" here line 278 column 33 - Error: document type does not allow element "TR" here line 280 column 33 - Error: document type does not allow element "TR" here line 282 column 33 - Error: document type does not allow element "TR" here line 284 column 33 - Error: document type does not allow element "TR" here line 286 column 33 - Error: document type does not allow element "TR" here line 288 column 33 - Error: document type does not allow element "TR" here line 290 column 33 - Error: document type does not allow element "TR" here line 292 column 33 - Error: document type does not allow element "TR" here line 294 column 33 - Error: document type does not allow element "TR" here line 296 column 33 - Error: document type does not allow element "TR" here line 298 column 33 - Error: document type does not allow element "TR" here line 300 column 33 - Error: document type does not allow element "TR" here line 302 column 26 - Error: end tag for "SPAN" omitted, but its declaration does not permit this line 248 column 30 - Info: start tag was here line 302 column 26 - Error: end tag for "CAPTION" omitted, but its declaration does not permit this line 248 column 30 - Info: start tag was here line 302 column 26 - Error: end tag for "TABLE" which is not finished line 304 column 34 - Error: document type does not allow element "DIV" here line 315 column 37 - Error: ID "INFO" already defined line 245 column 30 - Info: ID "INFO" first defined here line 316 column 56 - Error: "TABLE" is not a member of a group specified for any attribute line 316 column 62 - Error: "WIDTH" is not a member of a group specified for any attribute line 316 column 62 - Error: "90" is not a member of a group specified for any attribute line 317 column 86 - Error: document type does not allow element "TABLE" here line 318 column 59 - Error: document type does not allow element "SPAN" here; assuming missing "CAPTION" start-tag line 319 column 42 - Error: document type does not allow element "TR" here line 320 column 49 - Error: document type does not allow element "TR" here line 322 column 49 - Error: document type does not allow element "TR" here line 324 column 45 - Error: end tag for "SPAN" omitted, but its declaration does not permit this line 318 column 40 - Info: start tag was here line 324 column 45 - Error: end tag for "CAPTION" omitted, but its declaration does not permit this line 318 column 40 - Info: start tag was here line 324 column 45 - Error: end tag for "TABLE" which is not finished line 325 column 51 - Error: document type does not allow element "DIV" here line 328 column 51 - Error: ID "INFO" already defined line 245 column 30 - Info: ID "INFO" first defined here line 329 column 70 - Error: "TABLE" is not a member of a group specified for any attribute line 329 column 76 - Error: "WIDTH" is not a member of a group specified for any attribute line 329 column 76 - Error: "90" is not a member of a group specified for any attribute line 330 column 100 - Error: document type does not allow element "TABLE" here line 331 column 72 - Error: document type does not allow element "SPAN" here; assuming missing "CAPTION" start-tag line 332 column 51 - Error: document type does not allow element "TR" here line 333 column 58 - Error: document type does not allow element "TR" here line 334 column 58 - Error: document type does not allow element "TR" here line 335 column 58 - Error: document type does not allow element "TR" here line 336 column 53 - Error: end tag for "SPAN" omitted, but its declaration does not permit this line 331 column 53 - Info: start tag was here line 336 column 53 - Error: end tag for "CAPTION" omitted, but its declaration does not permit this line 331 column 53 - Info: start tag was here line 336 column 53 - Error: end tag for "TABLE" which is not finished line 337 column 60 - Error: document type does not allow element "DIV" here line 338 column 9 - Error: an attribute specification must start with a name or name token line 338 column 9 - Error: element "ALIGN" undefined line 342 column 33 - Error: ID "INFO" already defined line 245 column 30 - Info: ID "INFO" first defined here line 343 column 55 - Error: "TABLE" is not a member of a group specified for any attribute line 343 column 61 - Error: "WIDTH" is not a member of a group specified for any attribute line 343 column 61 - Error: "90" is not a member of a group specified for any attribute line 344 column 83 - Error: document type does not allow element "TABLE" here line 345 column 58 - Error: document type does not allow element "SPAN" here; assuming missing "CAPTION" start-tag line 346 column 43 - Error: document type does not allow element "TR" here line 347 column 50 - Error: document type does not allow element "TR" here line 348 column 50 - Error: document type does not allow element "TR" here line 349 column 50 - Error: document type does not allow element "TR" here line 350 column 50 - Error: document type does not allow element "TR" here line 351 column 50 - Error: document type does not allow element "TR" here line 352 column 44 - Error: end tag for "SPAN" omitted, but its declaration does not permit this line 345 column 39 - Info: start tag was here line 352 column 44 - Error: end tag for "CAPTION" omitted, but its declaration does not permit this line 345 column 39 - Info: start tag was here line 352 column 44 - Error: end tag for "TABLE" which is not finished line 353 column 51 - Error: document type does not allow element "DIV" here line 355 column 148 - Error: end tag for "I" omitted, but its declaration does not permit this line 355 column 6 - Info: start tag was here line 355 column 152 - Error: end tag for element "I" which is not open line 367 column 356 - Error: end tag for "I" omitted, but its declaration does not permit this line 367 column 22 - Info: start tag was here line 367 column 360 - Error: end tag for element "I" which is not open line 371 column 500 - Error: end tag for "I" omitted, but its declaration does not permit this line 371 column 397 - Info: start tag was here line 371 column 504 - Error: end tag for element "I" which is not open line 380 column 266 - Error: end tag for "I" omitted, but its declaration does not permit this line 380 column 22 - Info: start tag was here line 380 column 270 - Error: end tag for element "I" which is not open line 404 column 20 - Error: value of attribute "ALIGN" cannot be "CENTRE"; must be one of "LEFT", "CENTER", "RIGHT" line 408 column 46 - Error: document type does not allow element "UL" here; missing one of "TH", "TD" start-tag line 409 column 8 - Error: ID "INFO" already defined line 245 column 30 - Info: ID "INFO" first defined here line 410 column 13 - Error: value of attribute "ALIGN" cannot be "CENTRE"; must be one of "LEFT", "CENTER", "RIGHT" line 410 column 26 - Error: "TABLE" is not a member of a group specified for any attribute line 410 column 32 - Error: "WIDTH" is not a member of a group specified for any attribute line 410 column 32 - Error: "50" is not a member of a group specified for any attribute line 411 column 49 - Error: document type does not allow element "TABLE" here line 414 column 15 - Error: an attribute value must be a literal unless it contains only name characters line 414 column 16 - Error: document type does not allow element "TABLE" here line 415 column 73 - Error: an attribute specification must start with a name or name token line 415 column 73 - Error: element "CELLPADDING" undefined line 418 column 19 - Error: document type does not allow element "DIV" here line 428 column 20 - Error: value of attribute "ALIGN" cannot be "CENTRE"; must be one of "LEFT", "CENTER", "RIGHT" line 431 column 46 - Error: document type does not allow element "UL" here; missing one of "TH", "TD" start-tag line 432 column 8 - Error: ID "INFO" already defined line 245 column 30 - Info: ID "INFO" first defined here line 433 column 13 - Error: value of attribute "ALIGN" cannot be "CENTRE"; must be one of "LEFT", "CENTER", "RIGHT" line 433 column 26 - Error: "TABLE" is not a member of a group specified for any attribute line 433 column 32 - Error: "WIDTH" is not a member of a group specified for any attribute line 433 column 32 - Error: "50" is not a member of a group specified for any attribute line 434 column 49 - Error: document type does not allow element "TABLE" here line 437 column 15 - Error: an attribute value must be a literal unless it contains only name characters line 437 column 16 - Error: document type does not allow element "TABLE" here line 441 column 71 - Error: an attribute specification must start with a name or name token line 441 column 71 - Error: element "CELLPADDING" undefined line 444 column 19 - Error: document type does not allow element "DIV" here line 490 column 6 - Error: end tag for element "SPAN" which is not open line 491 column 4 - Error: end tag for "DIV" omitted, but its declaration does not permit this line 444 - Info: start tag was here line 491 column 4 - Error: "TABLE" not finished but containing element ended line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 434 - Info: start tag was here line 491 column 4 - Error: "TABLE" not finished but containing element ended line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 433 - Info: start tag was here line 491 column 4 - Error: end tag for "UL" omitted, but its declaration does not permit this line 431 - Info: start tag was here line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 428 - Info: start tag was here line 491 column 4 - Error: end tag for "DIV" omitted, but its declaration does not permit this line 418 - Info: start tag was here line 491 column 4 - Error: "TABLE" not finished but containing element ended line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 411 - Info: start tag was here line 491 column 4 - Error: "TABLE" not finished but containing element ended line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 410 - Info: start tag was here line 491 column 4 - Error: end tag for "UL" omitted, but its declaration does not permit this line 408 - Info: start tag was here line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 404 - Info: start tag was here line 491 column 4 - Error: end tag for "DIV" omitted, but its declaration does not permit this line 353 column 32 - Info: start tag was here line 491 column 4 - Error: "TABLE" not finished but containing element ended line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 343 column 31 - Info: start tag was here line 491 column 4 - Error: end tag for "UL" omitted, but its declaration does not permit this line 341 column 22 - Info: start tag was here line 491 column 4 - Error: end tag for "DIV" omitted, but its declaration does not permit this line 337 column 41 - Info: start tag was here line 491 column 4 - Error: "TABLE" not finished but containing element ended line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 329 column 46 - Info: start tag was here line 491 column 4 - Error: end tag for "UL" omitted, but its declaration does not permit this line 327 column 38 - Info: start tag was here line 491 column 4 - Error: end tag for "DIV" omitted, but its declaration does not permit this line 325 column 32 - Info: start tag was here line 491 column 4 - Error: "TABLE" not finished but containing element ended line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 316 column 32 - Info: start tag was here line 491 column 4 - Error: end tag for "UL" omitted, but its declaration does not permit this line 314 column 25 - Info: start tag was here line 491 column 4 - Error: end tag for "DIV" omitted, but its declaration does not permit this line 304 column 15 - Info: start tag was here line 491 column 4 - Error: "TABLE" not finished but containing element ended line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 246 column 25 - Info: start tag was here line 491 column 4 - Error: end tag for "UL" omitted, but its declaration does not permit this line 244 column 18 - Info: start tag was here line 491 column 4 - Error: end tag for "TABLE" omitted, but its declaration does not permit this line 240 column 11 - Info: start tag was here line 491 column 4 - Error: end tag for "DIV" omitted, but its declaration does not permit this line 173 column 9 - Info: start tag was here line 494 column 4 - Error: end tag for element "TD" which is not open line 495 column 14 - Error: document type does not allow element "TD" here line 497 column 4 - Error: end tag for element "TR" which is not open line 498 column 3 - Error: document type does not allow element "TR" here line 502 column 7 - Error: end tag for element "TABLE" which is not open line 504 column 22 - Error: end tag for "DIV" omitted, but its declaration does not permit this line 19 - Info: start tag was here line 506 column 2 - Error: document type does not allow element "P" here Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/#findComment-439587 Share on other sites More sharing options...
martin mosley Posted January 15, 2008 Author Share Posted January 15, 2008 Many thanks for that, though I am well and truely confused. Now I really am scared!! How do I correct this lot? I am working on a file called Alfred.php, and don't even know where the html file is to be found! Maybe I should admit defeat and accept I am not capable of doing this. Martin Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/#findComment-439591 Share on other sites More sharing options...
martin mosley Posted January 15, 2008 Author Share Posted January 15, 2008 Ok, I'm going to give it a crack... Can anyone give me a pointer where the first error on line 32 is? The analysis is very helpful, but I don't see what needs including. This code produces my table nicely in ie7, and seems to do the same in firefox. The problems appear to begin around the photographs which follow, together with their captions. The text should flow around them, but firefox breaks the text for the pictures, and offsets the captions. I also have a number of tables with empty cells which appear to have larger borders. I don't mind trying to work this out for myself, but could use some help to get started if anyone is feeling generous. Many thanks Martin Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/#findComment-439718 Share on other sites More sharing options...
martin mosley Posted January 15, 2008 Author Share Posted January 15, 2008 Maybe this is getting somewhere! I have managed to get the pictures aligned correctly, together with the captions. And I understand what i did to achieve it! I still have a problem with the tables which follow though... The header on the first one does not span the full length of the table, and blank cells appear to be formatted differently to those with content. Can anyone help me please. Martin Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/#findComment-439811 Share on other sites More sharing options...
nafetski Posted January 15, 2008 Share Posted January 15, 2008 A few things about browser cross compatability... Your HTML for the most part, view the same in both IE7 and in Firefox. If you're using much CSS - that's where some issues can occur. (CSS is notoriously different from browser to browser, IE7 is closer to standards than IE6 was...but most of us still develop in Firefox). If you validate your HTML - you will probably find most of your issues resolved. If you find that you're still having issues with things showing up different due to CSS, you can look for CSS workarounds (hacks) or just load a different external CSS file based on which browser the user is using. Here is a simple piece of code I wrote for that. <?php // Checks for the phrase MSIE (Internet Explorer) $ie = strpos($_SERVER['HTTP_USER_AGENT'], "MSIE"); // Checks for Firefox $firefox = strpos($_SERVER['HTTP_USER_AGENT'], "Firefox"); // Checks for Opera..just another example, I don't actually develop for Opera users. $opera = strpos($_SERVER['HTTP_USER_AGENT'], "Opera"); // This states that if the phrase MSIE in the $ie variable, then echo the IE stylesheet. if ($ie == TRUE){ echo "<link rel='stylesheet' media='all' type='text/css' href='../includes/careerstyles_ie.css'>"; } // This states if the phrase Firefox is in the $firefox variable, then echo the FF stylesheet elseif ($firefox == FALSE){ echo "<link rel='stylesheet' media='all' type='text/css' href='../includes/careerstyles_ff.css'>"; } // If neither are found, just use the IE one else{ echo "<link rel='stylesheet' media='all' type='text/css' href='../includes/careerstyles_ie.css'>"; } ?> Hopefully that helps, and gets your pointed in the right direction! Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/#findComment-439969 Share on other sites More sharing options...
cooldude832 Posted January 15, 2008 Share Posted January 15, 2008 the idea that a script doesn't display the same in different browsers is false beacuse a script in php is processed on your server and presented to the browsers the same way if its Ie FireFox or Safari etc. The reason it looks different is that your rendering doesn't follow acid2 and w3 compliances giving you a very open interpretation as to what you are actually attempting to display. Your best bet is to build to the w3 transitional doctype (Strict if you don't mind pulling your hair out), then varify it works in IE6, IE7, FF2 and the latest version of Safari, and if you notice any issues, patch them uses some of the css "hacks" that people have posted by googling your woes. Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/#findComment-439979 Share on other sites More sharing options...
martin mosley Posted January 15, 2008 Author Share Posted January 15, 2008 Thanks for those thoughts. I would agree that logically the processing is done on my server, therefore the question is directly related to the quality of my coding. This is the first everpage I have coded and I did it, verifying in my ie7 before someone said I should think seriously about firefox. Lesson number 1 verify in several browsers well learned! The problem I now have is that as an absolute beginner, I cannot see the syntax errors which were pointed out in the report on the second post here. I have played with the code and the page is looking a little more like I want it to, but there are still errors, and I don't understand them. Is there anyone willing to take a look and advise me? Many thanks Martin Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/#findComment-439990 Share on other sites More sharing options...
tinker Posted January 15, 2008 Share Posted January 15, 2008 This link might be what your after, the first tool is what gave the output in the second post, and this link will shed a little light on the DOCTYPE stuff. Also for the essential (if not expansive enough) the reference to keep under your keyboard (if you use it as a pillow that is, ooh mind the dribble!) Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/#findComment-440012 Share on other sites More sharing options...
martin mosley Posted January 15, 2008 Author Share Posted January 15, 2008 Well, what a surprise! I validated using the markup validation tool and guess what, my page looks better, but I have more errors than before! Just to make matters worse, the first error reported (just as an example) is # Error Line 32, Column 7: document type does not allow element "UL" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag. <ul> ✉ The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element. One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>"). Problem: I have no <ul>! Where is the relevance? Maybe I'm just getting thick in my old age.... Martin Quote Link to comment https://forums.phpfreaks.com/topic/86088-formating-pages-for-different-browsers-script-problem/#findComment-440056 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.