Including CSS Stylesheet Link from View CakePHP Version Gotcha

Written by James McDonald

March 17, 2014

Just ran into a version problem where my devel environment was running a cakephp version ahead of my live

In cake 2.4.1 this works:

// in layout
   echo $this->fetch('css');

// in view
$this->Html->css(
    array( 
'mio-accordion'
        ),
    array('block' => 'css')
    );

But in 2.3.1 you have to do this:

//same thing in layout as above 

// this in view
// you can put this options array
// strait into the css() block
$options = array(
  'inline' => false,
  'block' => 'css'
);

//notice this has three args
//the script file name as a file or 
// an array 
// 2nd arg is null
// then your options and html attribs.

$this->Html->css(
    'mio-accordion',
    null,  
    $options
);

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...