En config/application.config.php:
'modules' => array(
'Application',
'Modnuevo'
),
Ir a /module y duplicar la carpeta Application, a la nueva carpeta llamarla Modnuevo
module\Modnuevo
namespace Modnuevo;
Modnuevo/config/module.config.php:
'invokables'=>array(
'Modnuevo\Controller\Modnuevo'=>'Modnuevo\Controller\ModnuevoController'
...
'routes'=>array(
'modnuevo'=>array(
'type'=>'Segment',
'options'=>array(
'route' => '/modnuevo[/[:action]]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'controller' => 'Modnuevo\Controller\Modnuevo',
'action' => 'index'
),
),
),
),
...
'template_map' => array(
'modnuevo/index/index' => __DIR__ . '/../view/modnuevo/index/index.phtml',
module/Modnuevo/src/Modnuevo/Controller/ModnuevoController.php:
namespace Modnuevo\Controller;
...
class ModnuevoController extends...
module\Modnuevo\view\modnuevo\modnuevo\index.phtml
<h1>Mi primer modulo creado por mi</h1>
module\Leandro\view\layout\layout.phtml
<?php echo $this->doctype(); ?>
<html lang="es_ES">
<head>
<?php echo$this->headMeta()->setCharset('utf8')?>
<?php echo $this->headTitle($this->valor)?>
<?php echo $this->headLink()->prependStylesheet($this->basePath().'/css/estiloLSG.css')?>
<?php echo $this->headStyle()?>
<?php echo $this->headScript()->prependFile($this->basePath().'/js/jquery.min.js')?>
</head>
<body>
<div class="header">aa</div>
<div class="content"><?php echo $this->content?></div>
<div class="footer">footer</div>
<?php echo $this->inlineScript() ?>
</body>
</html>
No hay comentarios:
Publicar un comentario