short tags and xml declaration- solution?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

short tags and xml declaration- solution?

waigani-2
Is there a ZF solution to using both short tags and xml declaration in a view script? I know <? vs <?xml is a general php problem, but if the ZF manual continues to demonstrate with short tags (and I hope it will - long live short tags) then it would be good to have a solution for this long standing problem with short tags.

I've come across two solutions (neither ideal): 1. echo out xml declaration, 2. patch PHP source code (why is such a patch not standard?).

Can ZF do anything better?
Reply | Threaded
Open this post in threaded view
|

Re: short tags and xml declaration- solution?

waigani-2
On the same topic, is there a way to select <?xml with Zend_Dom? What would be the xpath or css query?

Waigani wrote
Is there a ZF solution to using both short tags and xml declaration in a view script? I know <? vs <?xml is a general php problem, but if the ZF manual continues to demonstrate with short tags (and I hope it will - long live short tags) then it would be good to have a solution for this long standing problem with short tags.

I've come across two solutions (neither ideal): 1. echo out xml declaration, 2. patch PHP source code (why is such a patch not standard?).

Can ZF do anything better?
Reply | Threaded
Open this post in threaded view
|

Re: short tags and xml declaration- solution?

weierophinney
Administrator
In reply to this post by waigani-2
-- Waigani <[hidden email]> wrote
(on Sunday, 28 September 2008, 12:08 AM -0700):

> Is there a ZF solution to using both short tags and xml declaration in a view
> script? I know <? vs <?xml is a general php problem, but if the ZF manual
> continues to demonstrate with short tags (and I hope it will - long live
> short tags) then it would be good to have a solution for this long standing
> problem with short tags.
>
> I've come across two solutions (neither ideal): 1. echo out xml declaration,
> 2. patch PHP source code (why is such a patch not standard?).
>
> Can ZF do anything better?

You could create a helper that echoes it out:
   
    <?= $this->xmlDecl(array('version' => '1.0', 'standalone' => 'true')) ?>

But it's not much different than simply doing this:

    <?= '<?xml version="1.0" standalone="true"?>' ?>

--
Matthew Weier O'Phinney
Software Architect       | [hidden email]
Zend Framework           | http://framework.zend.com/