css block

If you need a way to throw some CSS in a view, you may use the "css" smarty block plugin to pull it out when that view is called upon and automatically put the css in the header (where it should be).  

You MUST include the 'unique' parameter to provide a name to the block.  One ore more additional optional parameters include:

'link' - a pathname to the .css stylesheet file (the $asset_path variable is always available and points to the assets folder in that module):

{css unique="portfolio" link="`$asset_path`css/portfolio.css"}


'corecss' - the base name (without the .css) of one or more css files from /framework/core/assets:

{css unique="categories" corecss="categories,tables"}


'lesscss' - a pathname or array of pathnames to a LESS file to be complied to a CSS file.  The .less file should be within a /less folder and will be compiled to the same named .css file in the /css folder of the same parent as the /less folder.  The .css file will be recompiled if the associated .less file is newer or the passed variables ('lessvars') has changed.

{css unique="portfolio" lesscss="`$asset_path`css/portfolio.less"}


'lessvars' - an associative array of variables to pass to LESS files being complied.  These variables are applied to the 'lesscss' files.

{css unique="portfolio" lesscss="`$asset_path`css/portfolio.less" lessvars=$less_vars)}


You may include inline styles using the block between the opening and closing tag:

{css unique="inlinecss"}
your css goes here...

Remember to use the "literal" plugin to keep the smarty from interpreting your css or you may have errors. The "css" wrapper will tell exponent to pull it out and put it in the header of your document on the fly.

Loading Help