2009年3月11日星期三

Re: [fw-mvc] Standard Placeholders

-- SirEdward <gideon@hauntedfishtank.com> wrote
(on Wednesday, 11 March 2009, 12:54 PM -0700):
> I tried these suggestions out and I thought I'll post my findings for
> everyone else's benefit.
>
> > Not really. One thing to note, if you put a trailing space following
> > your closing PHP tag and then do a newline, you'll get the newline:
> >
> > <?php echo $this->headTitle() ?> <!-- space precedes... -->
> >
> > If you would like to see the PHP_EOL appended by default, please file a
> > feature request in the tracker.
>
> This does work and is very useful but it does mean that I get a space at the
> end of each line. I can live with this for the moment but would prefer a
> PHP_EOL so I'll submit a feature request.

Excellent, thanks.

> > It's already possible. Use the setIndent() method, and pass it a string
> > with a tab:
> >
> > $this->headScript()->setIndent("\t");
>
> This again is great. Although I see from the source of some of the helpers
> (HeadMeta etc.) that the output is prefixed with the indent as well. I don't
> personally think this is needed as I like to set my initial indent in my
> .phtml file to assist with readability in those.

It may make sense not render an initial prefix; again, file an issue for
this.

> > $this->view->escape($text);
> >
> >The $view public property is registered by default when extending
> >Zend_View_Helper_Abstract.
>
> Pretty obvious really! I can't believe I didn't think of this. I guess I've
> been writing too many $this->escape($text) in my view templates which don't
> require the ->view! Thanks!!

My problem is that I go the opposite way, and then get complaints that
the "view" property is undefined. :)

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: