reusing editable values and/or embedding PHP in stylesheets
Permalink
If I want to have a single defined value (eg a tint colour) that I use in multiple places inside a CSS file for a theme then is it possible to either a) a configurable theme style that I define once but reference at multiple locations inside a CSS file, or b) use PHP code to generate the stylesheet directly and store the re-used values inside some kind of global variable? I'm not too fussed about having a UI for defining the value, more that I want to be confident that it is updated in all the locations where it is used and therefore the theme remains consistent. Alternatively I could use SASS or similar to generate the CSS but this adds in another hoop to jump through for updates...
JohntheFish always provides solid add-ons that work well so his recommendation is certainly worth checking out.
Here's a pretty robust method I've used especially in creating blocks that have lots of css configuration options saved in the database:
http://css-tricks.com/css-variables-with-php/...
To apply the article's technique to a properly built concrete5 theme, you would include this code in the theme's 'elements/header.php' file after all your regular css files get added:
Adjust your path and file name to taste.
Although there are several add-ons that use this technique, you can check out the view.php file inside the Vimeo Thumbnail Gallery to see how this technique can work in a block
http://www.concrete5.org/marketplace/addons/vimeo-gallery1/...
Here's a pretty robust method I've used especially in creating blocks that have lots of css configuration options saved in the database:
http://css-tricks.com/css-variables-with-php/...
To apply the article's technique to a properly built concrete5 theme, you would include this code in the theme's 'elements/header.php' file after all your regular css files get added:
<link rel="stylesheet" type="text/css" href="<?php echo $this->getThemePath(); ?>/css/style.php" />
Adjust your path and file name to taste.
Although there are several add-ons that use this technique, you can check out the view.php file inside the Vimeo Thumbnail Gallery to see how this technique can work in a block
http://www.concrete5.org/marketplace/addons/vimeo-gallery1/...
Many concrete5 marketplace themes are already built in LESS or SASS - you just see the compiled results.
My solution to easy customisation is my Style Quickie addon. I put a Style Quickie block in my global headers and write LESS to override or add the styles I want. The style quickie block then pulls in resources, validates and compiles the LESS and inserts the CSS in the html header.
http://www.concrete5.org/marketplace/addons/style-quickie/...