On Apr 24, 3:02 pm, Jon Bennett <[email protected]> wrote:
> >> But, regardless how hard I try, the css <link [..]> gets printed at
> >> its own location instead of at $scripts_for_layout which remains
> >> empty.
>
> > Of course. It's because you call the element in the layout. By the
> > time the PHP interpreter arrives at that line, it's already passed the
> > line, up above, with echo $scripts_for_layout. This will work if you
> > instead include the element inside a view template.
>
> > Besides, if the element is inside a layout, you may as well include
> > the CSS in the layout itself.
>
> I don't think that's correct - you can use this technique to include
> javascript or css files from a view file, so I don't see any reason
> why you can't from within an element, the html helper isn't aware of
> the file that's called it.

Think about it some more. The layout contains a line to echo
$scripts_for_layout, which includes any CSS added in a view/element.
So, the PHP engine gets to that line and Cake spits out whatever non-
inline JS and CSS was added.

A few lines later, the element is encountered. How do you suppose the
call to $html-css() is supposed to reserve the link to be included in
$scripts_for_layout, rather than included inline?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to