2009年3月11日星期三

[fw-mvc] Standard Placeholders

Hi,

I have a question about some of the standard placeholder view helpers.

First of all, in order for my code I am outputting to look good when I
"View->Show Source" in the browser, I am having to overwrite the
__toString() function for a couple of these standard placeholders to
something like

<?php
class My_View_Helper_HeadTitle extends Zend_View_Helper_HeadTitle
{
public function __toString()
{
return parent::__toString() . PHP_EOL;
}
}


All I am doing is adding a break to the end of the outputted text (PHP_EOL)
but it makes such a difference. Otherwise I get my <html> tag on the same
line as my doctype and others. This may seem like a pointless exercise, but
in fact for front end developers it is very helpful to be able to read clean
looking HTML code using View Source (as Firebug is only available on
Firefox!)

Is there any reason why this isn't included on the standard placeholders?

Also, our company coding standards use TABs for HTML output and not SPACEs.
I see there is a getWhitespace() function which sets the number of spaces
for some placeholders (used in HeadLink for example) but I was wondering if
there are plans to give the option whether to use a SPACE or a TAB?

I would also overwrite this function to use tabs instead, but I don't know
how. Does anyone know what I need to do to overwrite this?

Finally, I've written a custom view helper to display a valid HTML nested
list using data read from my model. I'm returning this HTML back to my
layout. However, the data that I've read from my model is not clean so I
want to escape it before displaying it. How can I call the view helper
escape() function from within my own view helper (which extends
Zend_View_Helper_Abstract)?

Thanks for any help in advance. =)
--
View this message in context: http://www.nabble.com/Standard-Placeholders-tp22455713p22455713.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: