7 Replies Latest reply on Nov 16, 2008 9:45 AM by hen3ry

    legality/practicality of nesting complete, valid HTML pages

    hen3ry Level 1
      Folks:

      DW CS3 on MacOS 10.4.11 Intel

      Here's a skeleton, generic HTML page, call it "index.php". You'll see a bit
      of php code in the middle:

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      " http://www.w3.org/TR/html4/loose.dtd">
      <html>

      <head>
      ...
      </head>
      <body>
      ....
      <?php require("another_page.html"); ?>
      ...
      </body>
      </html>

      If the contents of "another_page.html" is valid, it contains, at the outer
      level, <html> .... </html>. That means, when the page is served up, the
      recipient browser will see something like this:

      <html>
      ....
      <html>
      ...
      </html>
      ...
      <html>

      That is, this produces completely nested -- though otherwise completely valid-- HTML
      files. I've read that doing this is a BAD IDEA... Sure, the HTML spec doesn't say you can do this, but I can't find any place it says you can't.

      Ummm, I've been nesting files like this for months, and I haven't noticed
      anything going wrong on the client. But I'm looking a very narrow test
      base: a single browser, only FireFox on MacOS 10.4.x.

      OK, common sense says you shouldn't risk doing unusual things to browsers. Based on what I've seen while research this issue, and on the fact that the resultant pages fail the W3C validation test, I'm convinced: this is definitely a BAD IDEA, and I need to fix it.

      You might guess that I have a deeper question. Yup! I've designed a site
      that has a single template page, index.php, which dynamically fills in
      content using php "require". I put individual chunks of content from .html
      files, all of which are stand-alone valid -- starting with <html> and ending
      with </html>. Bingo! Nested stand-alone-valid HTML files, the BAD IDEA.

      Why do I make all the .html files stand-alone valid? Because Dreamweaver
      insists. I can't get functioning WYSIWYG, nor I can use site-wide
      CSS otherwise. I need all that working to make the index page and the chunks right.

      Question 1: Doesn't this issue come up all the time in dynamic web page designs?

      Question 2: How do I fix or workaround this issue?

      I've thought about schemes to "unwind" the index page but they just rearrange the problem. There's no way to "un-contain" logically contained stuff.

      Does DW provide a way to "pseudo include" the outer elements for the purpose of authoring? I've looked, but I haven't found anything like that.

      Alternatively, there might be an script or an add-on that strips those elements from some files --the inner ones holding the content-- before uploading them. I haven't seen any such thing, but I'm not quite clear where to look.

      All other solutions I've heard involve hand-adjusting each file at each edit. That's totally impractical!

      TIA

      Henry