1. The Magento Config

Created Tuesday 12 August 2014

Setting up a module directory structure

A module is a group of php and xml files meant to extend or override core system behavior.


Creating a Module Config

When done, the module will:

  1. Check the existence of a "showConfig" query string variable
  2. If "showConfig" is present, display our Magento config and halt normal execution
  3. Check the existence of an additional query string variable "showConfigFormat" that will let specify text or xml output
  4. Add the <global> section to config.xml
class MyLearningModules_Configviewer_Model_Observer {
const FLAG_SHOW_CONFIG = 'showConfig';
const FLAG_SHOW_CONFIG_FORMAT = 'showConfigFormat';

private $request;

public function checkForConfigRequest($observer) {
$this->request = $observer->getEvent()->getData('front')->getRequest();
if ($this->request->{self::FLAG_SHOW_CONFIG} === 'true') {

private function setHeader() {
$format = isset($this->request->{self::FLAG_SHOW_CONFIG_FORMAT}) ?
$this->request->{self::FLAG_SHOW_CONFIG_FORMAT} : 'xml';
switch ($format) {
case 'text':
header("Content-Type: text/plain");
header("Content-Type: text/xml");

private function outputConfig() {
die (Mage::app()->getConfig()->getNode()->asXML());