We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

$DSP->extra_css Equivalent in EE2.0?

Development and Programming

Michael Witwicki's avatar
Michael Witwicki
115 posts
about 16 years ago
Michael Witwicki's avatar Michael Witwicki

Hey all,

Trying to figure out the best way to over-ride styles in the “View” files for EE2.0 Module development.

In 1.6.x I would have used $DSP->extra_css, but I’m not sure what the best way to accomplish something similar in 2.0 is. Hoping someone has run into this previously!

Cheers, will gladly buy someone with an answer a beer at EECI in SF if you are going!

  • Michael Witwicki
       
Manuel Payano's avatar
Manuel Payano
144 posts
about 16 years ago
Manuel Payano's avatar Manuel Payano

Here is one way:

$this->EE->cp->add_to_head('<link rel="stylesheet" href="URL_TO_CSS" type="text/css" media="print, projection, screen" />');

Or

$this->EE->cp->add_to_head('<style type="text/css"> SOME CSS </style>');
       
Michael Witwicki's avatar
Michael Witwicki
115 posts
about 16 years ago
Michael Witwicki's avatar Michael Witwicki

Absolutely perfect. Thank you so much. Do you happen to know if that CP class is documented anywhere?

Lemme know if you are heading out to EECI, so I can honor that beer.

  • MW
Here is one way:
$this->EE->cp->add_to_head('<link rel="stylesheet" href="URL_TO_CSS" type="text/css" media="print, projection, screen" />');
Or
$this->EE->cp->add_to_head('<style type="text/css"> SOME CSS </style>');
       
Michael Witwicki's avatar
Michael Witwicki
115 posts
about 16 years ago
Michael Witwicki's avatar Michael Witwicki

I think the other thing I am going to run into here is this:

If I want to bundle the CSS file inside the module, so something like:

/system/expressionengine/third_party/module-name/module.css

What is the best way to set the path to this file? Initially, I would have thought to just pass it relatively from the index.php page of the Control Panel, so something like:

href="expressionengine/third_party/module-name/module.css"

But, if the user installs EE above the web root, this will fail. Any thoughts? Maybe there is some kind of “path to cp” function in that CP class.

  • MW
       
Manuel Payano's avatar
Manuel Payano
144 posts
about 16 years ago
Manuel Payano's avatar Manuel Payano

Well i don’t like putting any JS/CSS in the system folder, but you can use the themes folder for things like that.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.