Saturday, April 24, 2010

Re: Using Non-Inline Css in Element

On Apr 23, 8:09 pm, Ch3ck3r <ad...@ch3ck3r.org> wrote:
> Hi folks,
>
> I am new to cakePHP and after two days reading I got quite far with my
> current application.
> Nevertheless I am stuck now.
>
> I created an Element called 'viewer.ctp' in the elements directory.
> This Element is used by my layout 'page.ctp' by using this command:
>
> <?php echo $this->element('viewer'); ?>
>
> This Element is properly shown in the layout but i have a problem with
> adding CSS Non-Inline.
> Inside of the viewer.ctp i got the following line
>
> <?php $html->css('viewer', null, null, false); ?>
>
> which should add the viewer.css file to my $scripts_for_layout which
> is located at the top of my layout file.
>
> 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.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate