Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The XML based structure of <strong>Magento</strong> seems bit confusing and annoying at the beginning but its well-known that eventually strong capability and customizability… </p> <pre><code>&lt;adminhtml_example_index&gt;&lt;/adminhtml_example_index&gt; </code></pre> <p>This tag refers to the <strong>[router]<em>[controller]</em>[action]</strong> The router is the uniquely identified name for a particular dispatch. From the example you’ve given, under the admin tag of the <strong><em>config.xml</em></strong> file, we can find the router name <code>adminhtml</code>.</p> <pre><code>&lt;admin&gt; &lt;routers&gt; &lt;adminhtml&gt; &lt;args&gt; &lt;modules&gt; &lt;awesome before="Mage_Adminhtml"&gt;Super_Awesome_Adminhtml&lt;/awesome&gt; &lt;/modules&gt; &lt;/args&gt; &lt;/adminhtml&gt; &lt;/routers&gt; &lt;/admin&gt; </code></pre> <p>Under that router are the module settings related to this router.</p> <p>So if the url contains <strong>/admin/example/[index]</strong>, magento will find the correct router which is <code>&lt;adminhtml&gt;</code> then will find the controller named <code>example</code> and find the correct action which is in this case <code>index</code> <em>(/admin/example/ will be dispatched to the default index action)</em></p> <pre><code>&lt;adminhtml_example_index&gt; &lt;reference name="content"&gt; &lt;block type="awesome/adminhtml_example" name="example" /&gt; &lt;/reference&gt; &lt;/adminhtml_example_index&gt; </code></pre> <p>In the layout file, for <strong>router controller action</strong> combinations, layout updates are defined. In here the update will be applied to the main block named as <code>content</code> which holds the page content section.</p> <p><code>&lt;block&gt;</code> tag is used to define the block we need to refer. <code>&lt;type&gt;</code> tag is important. It refers to the correct block class that should be used when rendering this layout <em>(Remember in Magento’s MVC structure the View consists of both Block classes and phtml files)</em></p> <p>In <code>awesome/adminhtml_example</code> here, <code>awesome</code> is the block configuration name mentioned in <strong>config.xml</strong> file. <code>adminhtml_example</code> is the block class to be used. </p> <p>See</p> <pre><code>&lt;global&gt; ----- &lt;blocks&gt; &lt;awesome&gt; &lt;class&gt;Super_Awesome_Block&lt;/class&gt; &lt;/awesome&gt; &lt;/blocks&gt; &lt;/global&gt; </code></pre> <p>Under the <code>block</code> tag, a unique block name is defined <em>(good naming convention will preserve the uniqueness)</em>. Then the class path for these block can be identified as <code>Super/Awsome/Block/</code>.</p> <p>Block configuration name is now resolved. <code>adminhtml_example</code> is the exact block class to be used. Any underscore after block name <em>(awesome)</em> will be converted to directory separator.</p> <p>According to that, the full path of the block class will be</p> <pre><code>[codepool]/Super/Awsome/Block/Adminhtml/Example.php </code></pre> <p>The class name will be like </p> <pre><code>class Super_Awesome_Block_Adminhtml_Example extends …. </code></pre> <p>If we have the layout file we can specify it here.. then that <code>.phtml</code> file will be rendered using the above block class</p> <pre><code>&lt;reference name="root"&gt; &lt;block type="page/html" name="root" template="simplepage.phtml" /&gt; &lt;/reference&gt; </code></pre> <p>Hope this helps.. Sorry if anything is unclear…</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload