I have a module that has some input fields in admin. One of the input is an ID that will use the same value every time, so I don't want to display that input in admin anymore to avoid changing or deleting it (i'm not the only one who has access to the admin panel). I talk to a friend and he tells me to put it in a configuration xml file and take it from there. It is possible to do that? How can I create a new xml file and take that value from there? Can anyone help me please?
So, after I search on the internet for a couple of days I finally managed to resolve my problem.
First I created a xml file in etc folder that looks like this:
<?xml version="1.0"?> <config> <appid>app_id_here</appid> </config>
To take the id from the file I use this code:
$configFile = Mage::getConfig()->getModuleDir('etc', 'Module_Name').DS.'file.xml'; $string = file_get_contents($configFile); $xml = simplexml_load_string($string, 'Varien_Simplexml_Element'); echo $xml->appid;
I hope in the future this will help some people.