2012-01-26, 14:11:29
Nope did not work. I copied word for word what you had listed also put the include in header and it did not work. Also I noticed it will not even recognize plain text in the style.php without this are the header:
------------------------------------------------------------------------------
function getXML($file) {
$xml = file_get_contents($file);
$data = simplexml_load_string($xml, 'SimpleXMLExtended', LIBXML_NOCDATA);
return $data;
}
------------------------------------------------------------------------------
But does not translate to what I need. My variables are not echoing to the page.
Also since this will be an external style sheet it will not be needing the <style> declaration at the top since the header is declared in the php as such
------------------------------------------------------------------------------
header("Content-type: text/css");
------------------------------------------------------------------------------
Do you have a working version you can share? Also if you have GETSIMPLE which I assume we all do on this forum, just take a look at your "/admin/template/style.php" page to see what I am trying to recreate but on the website theme area not the admin.
Seems GETSIMPLE has this working already without EOT<<< so I am not sure I need that to work, please any help will be appreciated. Thanks
------------------------------------------------------------------------------
function getXML($file) {
$xml = file_get_contents($file);
$data = simplexml_load_string($xml, 'SimpleXMLExtended', LIBXML_NOCDATA);
return $data;
}
------------------------------------------------------------------------------
But does not translate to what I need. My variables are not echoing to the page.
Also since this will be an external style sheet it will not be needing the <style> declaration at the top since the header is declared in the php as such
------------------------------------------------------------------------------
header("Content-type: text/css");
------------------------------------------------------------------------------
Do you have a working version you can share? Also if you have GETSIMPLE which I assume we all do on this forum, just take a look at your "/admin/template/style.php" page to see what I am trying to recreate but on the website theme area not the admin.
Seems GETSIMPLE has this working already without EOT<<< so I am not sure I need that to work, please any help will be appreciated. Thanks
n00dles101 Wrote:Include the file in your template somewhere in the header
Code:<? include get_theme_url(FALSE).'/style.php'; ?>
Then use heredoc syntax
http://www.php.net/manual/en/language.ty...ax.heredoc
to output your block of CSS code.
Your variables should then be available to your template.
Code:<?php
$v = getXML(GSDATAOTHERPATH.'ThemeSettings.xml');
$customvariable1 = $v->themevariable1;
$customvariable2 = $v->themevariable2;
$customvariable3 = $v->themevariable3;
$customvariable4 = $v->themevariable4;
echo <<< EOT
<style type="text/css" >
#customdiv {
background-color: #$customvariable1;
}
</style>
EOT;
Should work, Hope it helps,