-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.- creación y registro de nuestro modulo app/code/Pfay/Contacts/etc/module.xml app/code/Pfay/Contacts/registration.php Mas info de como crear un modulo : 7c3a945 2.- Creamos nuestro controlador Index: app/code/Pfay/Contacts/Controller/Test/Index.php OJO => LA CLASE CON NOMBRE INDEX para MAGENTO2 en realidad ES UNA ACCION en Magento 2 se tiene que crear un archivo por acción y tendrá que extender de la clase : ACTION. SIEMPRE tendrá que contar con el método EXECUTE(). 3.- Creamos la ruta para acceder a nuestro controlador: app/code/Luisdev/Helloworld/etc/frontend/routes.xml el nombre que se le asigno en la etiqueta FRONTNAME será el que usaremos en la ruta URL del navegador a la cual accedemos asi : http://magento240.local/contacts/test/index o tambien así: http://magento240.local/contacts/test/ 4.- Creamos otro ejemplo de acción para nuestro controlador app/code/Pfay/Contacts/Controller/Test/View.php a la cual accedemos asi : http://magento240.local/contacts/test/view 5.- Finalmente activamos y actualizamos y recompilamos php bin/magento setup:upgrade php bin/magento setup:di:compile chmod -R 777 var/ pub/ grep Pfay_Contacts app/etc/config.php
- Loading branch information
1 parent
3569e15
commit f693d0c
Showing
6 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
namespace Pfay\Contacts\Controller\Test; | ||
class Index extends \Magento\Framework\App\Action\Action | ||
{ | ||
public function execute() | ||
{ | ||
die('test index'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
namespace Pfay\Contacts\Controller\Test; | ||
class View extends \Magento\Framework\App\Action\Action | ||
{ | ||
public function execute() | ||
{ | ||
die('test index View'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> | ||
<router id="standard"> | ||
<route id="contacts" frontName="contacts"> | ||
<module name="Pfay_Contacts" /> | ||
</route> | ||
</router> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="Pfay_Contacts" setup_version="2.0.0"> | ||
<sequence> | ||
<module name="Magento_Cms"/> | ||
</sequence> | ||
</module> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
<?php | ||
\Magento\Framework\Component\ComponentRegistrar::register( | ||
\Magento\Framework\Component\ComponentRegistrar::MODULE, | ||
'Pfay_Contacts', | ||
__DIR__ | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters