-- Simon Mundy <[EMAIL PROTECTED]> wrote
(on Tuesday, 18 December 2007, 04:35 PM +1100):
> Sorry for the irregular emails!
No problem... keep the feedback coming!
> I've just started playing with the HeadStyle helper and had some quick
> Q's for yourself and the list:-
>
> Escaping
> The Helper escapes XHTML by using the <![CDATA[ and ]]> meta string, however
> without that appropriate /* */ wrapper, my browser (Safari) throws a wobbly.
> Would it be more appropriate to assume the /* <![CDATA[ */ prefix and /* ]]>
> */
> suffix as default?
Yes -- I'll fix that shortly.
> Multiple definitions
> If I add styles atomically:-
>
> <? $this->headStyle()->appendStyle('#heading1 { background-image: url(/img/
> heading/member-foo.png) }') ?>
> <? $this->headStyle()->appendStyle('#heading2 { background-image: url(/img/
> heading/member-bar.png) }') ?>
> <? $this->headStyle()->appendStyle('#heading3 { background-image: url(/img/
> heading/member-other.png) }') ?>
>
> ...the output shows something like this:-
>
> <style type="text/css">
> <![CDATA[
> #heading1 { background-image: url(/img/heading/member-foo.png) }
> ]]>
> </style>
> <style type="text/css">
> <![CDATA[
> #heading2 { background-image: url(/img/heading/member-bar.png) }
> ]]>
> </style>
> <style type="text/css">
> <![CDATA[
> #heading3 { background-image: url(/img/heading/member-other.png) }
> ]]>
> </style>
>
> Would it not be better to iterate through all the style items and then provide
> the <style> tag as a wrapper to this? Or did you intend for potentially more
> than 1 style declaration per document?
I actually intended for more than 1 style declaration per <script> tag.
Why? To allow for different media types. If it acts as a simple
aggregator, you can't define multiple <style> declarations with separate
media types.
> What would be the appropriate syntax for combining these 1-by-1?
A new helper. :-)
> Default attributes
> Would media set to 'screen' be the best default (being the most likely of the
> targets for a website) - obviously print pages, etc, can be handled on a
> per-page basis.
Yes -- I'll make that change as well.
> ...so ultimately I'd like to do this:-
>
> View:-
> <? $this->headStyle()->appendStyle('#heading1 { background-image: url(/img/
> heading/member-foo.png) }') ?>
> <? $this->headStyle()->appendStyle('#heading2 { background-image: url(/img/
> heading/member-bar.png) }') ?>
> <? $this->headStyle()->appendStyle('#heading3 { background-image: url(/img/
> heading/member-other.png) }') ?>
>
> Layout:-
> <?= $this->headStyle() ?>
>
> ...and get this:-
>
> <style type="text/css" media="screen">
> /* <![CDATA[ */
> #heading1 { background-image: url(/img/heading/member-foo.png) }
> #heading2 { background-image: url(/img/heading/member-bar.png) }
> #heading3 {background-image: url(/img/heading/member-other.png) }
> /* ]]> */
> </style>
>
> Is this what other people expect, or is there a better way to achieve this
> within the current API? Am keen to see what everyone thinks...
I think this would be a good candidate for an additional helper, perhaps
something like 'headStylesheet' -- which would indicate a *singular*
stylesheet.
I don't have the bandwidth to tackle it currently, but if you'd like to
place a JIRA issue for a feature improvement, I'll tackle it when I *do*
have time. :-)
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/