External script to Display All category which are created in magento.
Below is the code to display all category.
create new file in root of the magento source and add below code in that file
require_once 'app/Mage.php';
$app = Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$categoriesArray = Mage::getModel('catalog/category')
->getCollection()
->addAttributeToSelect('name')
->addAttributeToSort('path', 'asc')
->load()
->toArray();
$categories = array();
foreach ($categoriesArray as $categoryId => $category) {
if (isset($category['name']) && isset($category['level'])) {
$categories[] = array(
'level' => $category['level'],
'label' => $category['name']
);
}
}
echo "<pre>";
print_r($categories);
Above code will display all categories as below screenshot: