KodeFor.Me
KodeFor.Me

Reputation: 13511

CakePHP Plugin CSS

I create a plugin for application installation in CakePHP. In my plugin folder I have create the folder structure:

/app
    /Plugin
        /Install
            /Controller
                /Component
            /Model
                /Behavior
            /View
                /Helper
                /Install
                /Layouts
                    /Installer.ctp
            /webroot
                /css
                    default.css

Now in my Installer.ctp I have enter that code:

<?php

    echo $this->Html->css('/Install/default.css');

?>

but the CakePHP return to me the URL /cp/Install/default.css

Any idea on how to make the plugin to load the correct file from within the plugin folder webroot ?

Upvotes: 3

Views: 4978

Answers (2)

AFMeirelles
AFMeirelles

Reputation: 419

I know it's an old post, but I'd like to share another approach: you can pass 'PluginName.css-file' as parameter:

echo $this->Html->css('Install.default');

Works like a charm.

Upvotes: 9

mark
mark

Reputation: 21743

it should be

echo $this->Html->css('/install/css/default');

also note the lowercase i

Upvotes: 9

Related Questions