Saturday, 06 October 2012 17:52

Quick & Dirty: Sidestep the CSS Variables in the backend with your own Stylesheet.

Written by
Rate this item
(1 Vote)

If you are like me, you like to put your css changes in a file. That's my preference anyway. However I like to work with in the system as much as possible so instead of just dropping a <link> tag in my template, I am using the style_compute api hook.

------------------------------------------------------------
If you know nothing of APIHooks in iLance go HERE and read up!
-------------------------------------------------------------
If you have a "System" plugin file (one plugin file that you are using for all of your apihook modifications) open it up and add:

<plug key="selling_activity_end" addon="fishingnumbers">
<title>Expired Selling Activity</title>
<api>selling_activity_end</api>
<php><![CDATA[


]]>
</php>
</plug>
Then in the CDATA part drop the following:
PHP Code:
if(file_exists($path . $file_name)){
$content = file_get_contents($path . $file_name);

$this->computed_style .= $content . LINEBREAK;
}
You can switch $file_name with whatever you like, not to mention the directory (I like to keep my styling with my template, so I put it in my /templates/[TEMPLATE_NAME]/css/ folder).

Added bonus:
If you wanted to load multiple files in that directory do the following:
$content = null;
foreach(new DirectoryIterator($path) as $file){

if(!$file->isDot()){
$file_name = $file->getFilename();
$content = file_get_contents($path . $file_name);
$this->computed_style .= $content . LINEBREAK;
}

}
Read 12053 times Last modified on Monday, 08 October 2012 00:58
Cameron

Cameron is a PHP Application Developer and consultant and spends much of his time furthering the business goals of his company Magnetic Merchandising Inc. which he started in 2005.

Cameron has provided technical deployment and consultation for many entities since starting MMI. Much of that work has been in complex hosted auction platforms, professional Joomla! deployments and extension development and sales.

As such, Cameron has acquired a deep technical skill-set, a sensitivity to client needs, and the ability to produce anything those clients can visualize.

Everyday, he actively seeks out and becomes familiar technologies that will give MMI clients maximum return for their web development and general e-presence dollar.

magneticmerchandising.com