Skip to content
Anthony Short edited this page Aug 17, 2010 · 4 revisions

This extension allows you to add variables via XML. It requires the Variables extension.

Usage

You start by creating an XML file somewhere on your server, either manually, or you can have your CMS or programmatically create one:

<?xml version="1.0" ?>
<variables>
	<variable name="font_family">Helvetica</variable>
	<group name="colors">
		<variable name="text">#000</variable>
	</group>
	<group name="ad">
		<variable name="height">300px</variable>
		<variable name="width">250px</variable>
	</group>
</variables>

This will create variables to the equivalent of this in CSS:

@variables var 
{
    font_family:Helvetica;
}

@variables colors
{
    text:#000;
}

@variables ad
{
   height:300px;
   width:250px;
}

Or this in PHP

<?php
array(
	'var' 			=> array('font_family'=>'Helvetica'),
	'colors' 		=> array('text'=>'#000'),
	'ad' 			=> array('height'=>'300px','width'=>'250px'),
)

Using XML files

There are two ways you can call an XML file to use in your CSS. Firstly, you can call it using the @variables directive:

@variables 'variables.xml';

Or, you can add the XML file to your Scaffold configuration:

<?php
$config['XMLVariables']['files'] = array(
   'path/to/file.xml',
   'another/xml/file.xml'
);

Hooks

This extension has no hooks.

Clone this wiki locally