Sometimes, it’s nice to just quickly whip out a single page
Magento script to test something such as new API you are trying to talk
to. But, if that page is going to use
Magento’s functionality, it needs to load up all the XML control files first so
Magento knows where to find its classes.
The following script does just that:
<?php
/*
* place this in a subdirectory under docroot
* i.e. docroot/script/testClass.php
* http://your-test-server/script/testClass.php
*
*/
$baseDir = dirname(dirname(__FILE__));
include_once $baseDir . "/app/Mage.php";
class testClass {
public function run() {
Mage::App();
$config = Mage::GetConfig();
$config->init();
// your test code here
}
}
$testClass = new testClass;
$testClass->run();
?>
No comments:
Post a Comment