Author Topic: PHP / XHTML help  (Read 1493 times)

0 Members and 1 Guest are viewing this topic.

Offline azkiwi

  • Senior Contributor
  • ****
  • Posts: 160
    • Maricopa, Sonoran Desert, Arizona
PHP / XHTML help
« on: March 30, 2013, 10:53:48 AM »
Spent a lot of time yesterday moving all my new routines into 'production.  I have one error in the validation routine.
I have made a change in header.php to show the Metric /Imperial Temps on the top, title line and it's not real happy with what I did.

The code is  ---
<!-- header -->
    <div id="header">
      <h2 class="headerTitle">
     
             <a href="index.php" title="Browse to homepage"><?php echo langtransstr($SITE['organ']); ?></a>
       <div style="float: right;" >
   <span class="doNotPrint">   
   &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Currently it's &nbsp; 

   <?php echo $tempinmetric;?> - <?php echo $temperature;?></span>
</div>

and the error message is --

Line 174, Column 35: document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag
       <div style="float: right;" >

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>").


Tells me that float, or the way I've used it, is invalid.

How should I go about fixing it?

weather.azkiwis.net

Thanks


Ken

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1824
    • Maumelle Weather
Re: PHP / XHTML help
« Reply #1 on: March 30, 2013, 03:09:11 PM »
Hi Ken,

Try changing <div style="float: right;" > to <div style="text-align: right;"> . This may clear the error.

John
GR2AE, GR3, Cumulus

Offline azkiwi

  • Senior Contributor
  • ****
  • Posts: 160
    • Maricopa, Sonoran Desert, Arizona
Re: PHP / XHTML help
« Reply #2 on: March 31, 2013, 04:09:48 PM »
Hi John,
Thanks, had a little free time this morning and tried it ---

Nope, still gave the error  - and wrapped /extended the temp data I was displaying to the end of a wrapped around line.

Since it's only one error, albeit in every page, I'm going to live with it for the time being and dig into some tutorials on php /xhtml standards to see if anything pops out at me.


Ken



Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1824
    • Maumelle Weather
Re: PHP / XHTML help
« Reply #3 on: March 31, 2013, 05:07:27 PM »
Hi Ken,

Try one of 2 things.  In your header.php file:

    <div id="header">
      <h2 class="headerTitle">
      
             <a href="index.php" title="Browse to homepage">Maricopa Weather </a>
    <div style="float: right;" >  
 
   <span class="doNotPrint">  
   &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Currently it's &nbsp;  

    - </span>
    </div></div>  Add a second </div> here and see what happens or remove the <div style="float: right;" > .  Either way should fix the error.

John
GR2AE, GR3, Cumulus

Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 528
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: PHP / XHTML help
« Reply #4 on: March 31, 2013, 05:11:52 PM »
Perhaps the problem is trying to put a div within an h2?

- Jim

Forum Search and Google Can be Your Best Friends

Offline azkiwi

  • Senior Contributor
  • ****
  • Posts: 160
    • Maricopa, Sonoran Desert, Arizona
Re: PHP / XHTML help
« Reply #5 on: April 01, 2013, 06:48:10 PM »
John & Jim --- Tried suggestions, and variants of them; neither worked, still got one (or more) error msg on validation.


It's not a show stopper -- and when I'm back to having a respite from kidsitting,  I plan to play around some more



Thanks

Ken

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1824
    • Maumelle Weather
Re: PHP / XHTML help
« Reply #6 on: April 01, 2013, 07:10:08 PM »
Hi Ken,

Jim is going in the right direction, I believe.

Try this version:

    <div id="header" style="float: right;">
      <h2 class="headerTitle">
     
             <a href="index.php" title="Browse to homepage">Maricopa Weather </a>
   <div style="float: right;" >
 
   <span class="doNotPrint">   
   &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Currently it's &nbsp; 

   28.9°C - 84.0°F</span>
    </div>

Try adding what I've got it red and removing what I have in green and see what happens.

John
GR2AE, GR3, Cumulus