I have created two differents modules Test and First associated to different namespaces : Pfay (Test), Train (First).
For some reason this link http://localhost/magento/index.php/first/index/
will call the function IndexAction of Test/controllers/indexController.php as well
Here are the codes : for Test
<?php
class Pfay_Test_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
?>
for First:
<?php
class Train_First_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
// echo "First Index";
}
}
?>
config.xml (test)
<?xml version="1.0"?>
<config>
<modules>
<Pfay_Test>
<version>1.0.0</version>
</Pfay_Test>
</modules>
<frontend>
<routers>
<routeurfrontend>
<use>standard</use>
<args>
<module>Pfay_Test</module>
<frontName>test</frontName>
</args>
</routeurfrontend>
</routers>
<layout>
<updates>
<test>
<file>test.xml</file>
</test>
</updates>
</layout>
</frontend>
<global>
<blocks>
<test>
<class>Pfay_Test_Block</class>
</test>
</blocks>
</global>
</config>
config.xml (first)
<?xml version="1.0"?>
<config>
<modules>
<Train_First>
<version>1.0.0</version>
</Train_First>
</modules>
<frontend>
<routers>
<routeurfrontend>
<use>standard</use>
<args>
<module>Train_First</module>
<frontName>first</frontName>
</args>
</routeurfrontend>
</routers>
<layout>
<updates>
<first>
<file>first.xml</file>
</first>
</updates>
</layout>
</frontend>
<global>
<blocks>
<first>
<class>Train_First_Block</class>
</first>
</blocks>
</global>
</config>
test.xml
<layout version="0.1.0">
<default>
<reference name="content">
</reference>
</default>
<routeurfrontend_index_index>
<reference name="content">
<block type="test/monblock" name="afficher_monbloc"
template="test/afficher.phtml" />
</reference>
</routeurfrontend_index_index>
<routeurfrontend_index_mamethode>
<reference name="content">
<block type="test/monblock" name="afficher_monbloc"
template="test/afficher2.phtml" />
</reference>
</routeurfrontend_index_mamethode>
</layout>
first.xml
<layout version="0.1.0">
<default>
<reference name="content">
</reference>
</default>
<routeurfrontend_index_index>
<reference name="content">
<block type="first/firstblock" name="firstblocindex"
template="first/first_afficher.phtml" />
</reference>
</routeurfrontend_index_index>
<routeurfrontend_index_mamethode>
<reference name="content">
<block type="first/firstblock" name="firstblocmamethode"
template="first/first_afficher.phtml" />
</reference>
</routeurfrontend_index_mamethode>
</layout>
And for some reason http://localhost/magento/index.php/test/index/
does not work anymore (404 not found). There are probably some conflicts but I can't find where.
You can see here the problems.