On Mon, May 24, 2010 at 2:46 PM, Bruno Friedmann <[email protected]> wrote:
> On 05/15/2010 02:54 AM, Andrew Ballard wrote:
>> On Fri, May 14, 2010 at 4:57 PM, Hector Virgen <[email protected]> wrote:
>>> What problem are you having with "&nbsp;"? I didn't realize it's not valid
>>> XHTML. Should it be "&#160;" instead?
>>>
>>> --
>>> Hector
>>
>> That was my understanding. Being based on XML, I understood that the
>> only entities defined in XHTML were those defined in XML -- &lt;, &gt;
>> &quot; and &apos;.
>>
>> The few times (a while ago) that I tried to parse XHTML documents with
>> various parsers, they would not work unless they used &#160;/&#xA0;
>> for non-breaking spaces rather than &nbsp;. That is consistent with
>> the error I saw in Firefox. I have read documents on the web how you
>> can define your own entities in an XML document to add &nbsp;, but
>> I've also read that you cannot extend the XHTML doctype.
>>
>> Andrew
>
> Andrew I don't really understand the trouble with &nbsp; I'm using it on 
> website ( ZF + XHTML1.1 STRICT )
> and they validate at 100%.
>
> Perharps this is due the header used ?
>
> Check it at http://it.ioda-net.ch/
> I'm working with ZF-1.10 with layout.
>
> Bootstrap containing
>    protected function _initDoctype()
>    {
>        $this->bootstrap('view');
>        $view = $this->getResource('view');
>        $view->doctype('XHTML11');
>    }
>
> Extract from the layout :
> <?php
>    echo '<?xml version=\'1.0\' encoding=\'utf-8\' ?>', PHP_EOL;
>    echo $this->doctype(), PHP_EOL;
> ?>
> <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="<?php echo $this->lang; 
> ?>">
> <head>
> <base href="http://<?php echo (( isset($_SERVER['SERVER_NAME']) )? 
> $_SERVER['SERVER_NAME'] : 'localhost' ) . $this->baseUrl();
> ?>/" />
> <?php
> echo $this->headMeta()
>    ->setHttpEquiv('Content-Type', 'application/xhtml+xml; charset=utf-8')
>    ->setHttpEquiv('Content-Style-Type', 'text/css')
>        ->setHttpEquiv('lang', $this->lang )
>        ->setHttpEquiv('imagetoolbar', 'no')
>
> ...
>
> They work great with IE7+ Opera9.5+ FF3.5+ Safari 4+
> And it's validate against w3c validator ...
>
>
> --
>
>     Bruno Friedmann
>
>

I think it must have been because of the XML declaration at the top of
the page on that site. I hadn't noticed when I typed the declaration
at the top of my layout.php file that the code completion added
standalone="yes" to the page, and apparently that triggers some
browsers to ignore the external documents referenced by the XHTML 1.0
DTD that define character entities. The pages worked fine when they
had a meta-tag at the top declaring them to be application/xhtml+xml,
but when I added an HTML header for the content-type, Firefox 3 and
Opera both complained about the page. Once I changed the page to
standalone="no", it loaded fine in all the browsers I tested.

I'm not fully ready to switch to the application/xhtml+xml mime-type
just yet though. I found some other browser issues (not related to
Zend Framework at all) that need to be addressed first.

As it is, I think the only remaining issue I know of with using the
"correct" mime-type is that any styles I add using the
Zend_View_Helper_HeadStyle view helper are ignored by some browsers.
That's not a big deal, though, since it is easy enough to save the
style information to an external CSS file and include it using the
Zend_View_Helper_HeadLink view helper instead.

Andrew

Reply via email to