Friday, October 3, 2014

Re: cakePHP 3.0 load css from plugin

My answer there was about how to let composer load the classes for you, not about making them available magically everywhere.

Personally I think it is a bad idea to force an app to have some css or some helper always loaded. Just tell your users to load your css or javascript on demand,
same with the helpers.

On Friday, October 3, 2014 2:54:38 PM UTC+2, Radharadhya Dasa wrote:
Ah I see your answer on stakoverflow. I will try it.

Thank you.

rrd

2014-10-03 14:48 GMT+02:00 Radharadhya Dasa <rrd@krisna.hu>:
> Sorry, stupid clipboard...
>
> So I added DispatcherFactory::add('Asset'); to my plugins' bootsrap.php file.
>
> What I want to achieve if the user load my plugin the plugin
> automatically loads the necessary css, js files and helpers and
> components.
>
> My plugin is a helper without a controller.
>
> rrd
>
> 2014-10-03 14:35 GMT+02:00 José Lorenzo <jose.zap@gmail.com>:
>> I have no idea what you're talking about. There is no $this object in any
>> bootstrap.php file
>>
>> To include css files to a page you just add them to your templates using
>> $this->Html->css();
>>
>>
>> On Friday, October 3, 2014 1:50:14 PM UTC+2, Radharadhya Dasa wrote:
>>>
>>> I added $this->loadComponent('Math'); to my plugins' bootstrap.php
>>> file but it did not load my css and js files automatically if the
>>> plugin is installed. I copied the solution from DebugKit but I think
>>> there should be some easier way than through EventManager.
>>>
>>> Could you give me an example?
>>>
>>> I would like to load helpers and components automatically if the
>>> plugin is installed, but I did not find a soution for this also. Any
>>> example would be appreiated.
>>>
>>> rrd
>>>
>>> 2014-10-02 21:31 GMT+02:00 José Lorenzo <jose.zap@gmail.com>:
>>> > Same as in cake 2, you add the AssetsFilter to the dispatcher and put
>>> > your
>>> > files in the plugin's webroot folder
>>> >
>>> > On Thursday, October 2, 2014 4:29:50 PM UTC+2, Radharadhya Dasa wrote:
>>> >>
>>> >> Hi,
>>> >>
>>> >> How should I load a css file from a plugin on cake 3.0? I would like to
>>> >> let the plugin to laod its css file automatically if it is installed.
>>> >>
>>> >> rrd
>>> >
>>> > --
>>> > Like Us on FaceBook https://www.facebook.com/CakePHP
>>> > Find us on Twitter http://twitter.com/CakePHP
>>> >
>>> > ---
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "CakePHP" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> > an
>>> > email to cake-php+unsubscribe@googlegroups.com.
>>> > To post to this group, send email to cake-php@googlegroups.com.
>>> > Visit this group at http://groups.google.com/group/cake-php.
>>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to cake-php+unsubscribe@googlegroups.com.
>> To post to this group, send email to cake-php@googlegroups.com.
>> Visit this group at http://groups.google.com/group/cake-php.
>> For more options, visit https://groups.google.com/d/optout.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: