SimpleXML and Themes
-
I’m trying to setup a simple method of storing and retriving variables using SimpleXML.
It looks something like this:
The Code[options.php]:
$options = array(
‘style’ = simplexml_load_file(‘style.xml’),
‘class’ = simplexml_load_file(‘class.xml’),
…
…
);The XML[class.xml]:
<?xml version=’1.0′ encoding=’UTF-8′?>
<class>
<alignment_recentposts>leftalign</alignment_recentposts>
<alignment_postbycategory>rightalign</alignment_postbycategory>
…
…
</class>And the is loaded like this:
<div class=”recent <?php echo $options[‘class’]->alignment_recentposts; ?>”>
…
…
</div>Outside or wordpress this works fine, inside it fails. I don’t have access to the php server settings, so I can’t turn on error logging or see any sort of errors. It just goes blank at the point of the error, making debugging very difficult. I’ve downloaded software to help with the debugging, but I don’t particularly want to install a full test server and database to support wordpress for debugging, so I just stick to simple troubleshooting with this software.
I’ve tried include(‘options.php’) in the header, in the body, i’ve changed the varable name from $options to $vars to $poopie, and I still get the same results, so its not a conflict. Once I comment out the ‘simplexml_load_file’ function it works. I haven’t tested to see if I can set any variable to an object in the same location in the code, but I just want to see if there is any solutions. Thanks.
-
At wordpress.COM we cannot do PHP script for security reasons. We also cannot do javascript, flash, iframes or forms for the same reason.
From your post it you are talking about a self-hosted install of wordpress which is different from what is here and here, we have a lot of restrictions. For support on self-hosted blogs, you need to head over to http://wordpress.ORG/support/ .
- The topic ‘SimpleXML and Themes’ is closed to new replies.