2012-01-25, 12:29:52
To the smart one that figures this out, you have my thanks upfront:
I have a custom style page for my theme. Using a PHP page instead of a traditional CSS page, just like it is done in "/admin/template/style.php"
MY REASONS: I want to be able to dynamically load the variables from the theme's XML data file into this page. Just like it is done by GETSIMPLE already on "/admin/template/style.php"
I am adding including this in my theme header like so:
---------------------------------------------------------------------------------
<link rel="stylesheet" type="text/css" media="screen" href="<?php get_theme_url(); ?>/style.php">
---------------------------------------------------------------------------------
In the content of the PHP file I define the CSS header so it is treated like a CSS page when echoed like so:
---------------------------------------------------------------------------------
<?php
header("Content-type: text/css");
function getXML($file) {
$xml = file_get_contents($file);
$data = simplexml_load_string($xml, 'SimpleXMLExtended', LIBXML_NOCDATA);
return $data;
}
$v = getXML(GSDATAOTHERPATH.'ThemeSettings.xml');
$customvariable1 = $v->themevariable1;
$customvariable2 = $v->themevariable2;
$customvariable3 = $v->themevariable3;
$customvariable4 = $v->themevariable4;
?>
#customdiv {
background-color: #<?php echo $customvariable1; ?>;
}
---------------------------------------------------------------------------------
MY ISSUE:
I cannot seem to display the variables defined. I have narrowed my errors or issues to 2 main things if I am correct.
1. The style.php file does not have permissions to read the theme's xml data file.
2. The style.php file is not properly registered within GETSIMPLE so it will not work properly or it is not recognized as a file to access data safely.
3. There are some GETSIMPLE tags that needs to be added to the header or somewhere to validate this page as part of the theme files.
The funny thing I cannot wrap my brain around is that, multiple files use theme XML data variables: functions.php, header.php, template.php e.t.c
I need help I have been at this for a hours, reading documentations and so on. I need you smart guys out there to come to my aid. Thanks-a-bunch.
I have a custom style page for my theme. Using a PHP page instead of a traditional CSS page, just like it is done in "/admin/template/style.php"
MY REASONS: I want to be able to dynamically load the variables from the theme's XML data file into this page. Just like it is done by GETSIMPLE already on "/admin/template/style.php"
I am adding including this in my theme header like so:
---------------------------------------------------------------------------------
<link rel="stylesheet" type="text/css" media="screen" href="<?php get_theme_url(); ?>/style.php">
---------------------------------------------------------------------------------
In the content of the PHP file I define the CSS header so it is treated like a CSS page when echoed like so:
---------------------------------------------------------------------------------
<?php
header("Content-type: text/css");
function getXML($file) {
$xml = file_get_contents($file);
$data = simplexml_load_string($xml, 'SimpleXMLExtended', LIBXML_NOCDATA);
return $data;
}
$v = getXML(GSDATAOTHERPATH.'ThemeSettings.xml');
$customvariable1 = $v->themevariable1;
$customvariable2 = $v->themevariable2;
$customvariable3 = $v->themevariable3;
$customvariable4 = $v->themevariable4;
?>
#customdiv {
background-color: #<?php echo $customvariable1; ?>;
}
---------------------------------------------------------------------------------
MY ISSUE:
I cannot seem to display the variables defined. I have narrowed my errors or issues to 2 main things if I am correct.
1. The style.php file does not have permissions to read the theme's xml data file.
2. The style.php file is not properly registered within GETSIMPLE so it will not work properly or it is not recognized as a file to access data safely.
3. There are some GETSIMPLE tags that needs to be added to the header or somewhere to validate this page as part of the theme files.
The funny thing I cannot wrap my brain around is that, multiple files use theme XML data variables: functions.php, header.php, template.php e.t.c
I need help I have been at this for a hours, reading documentations and so on. I need you smart guys out there to come to my aid. Thanks-a-bunch.