Du befindest dich hier in der Application, jedoch solltest du dir ein eigenes Modul anlegen. Ich weiß es ist am Anfang sehr verwirrend, daher empfehle ich dir am besten das ZF2 Tutorial am Anfang dazu anzuschauen. Dort wird dies anhand eines Beispiels gut erklärt. Bei Fragen kannst du gerne auf mich zurück kommen.
Hier ein kleines Beispiel.
Verwaltung
[INDENT]config
[INDENT]module.config.php[/INDENT]
src
[INDENT]Verwaltung
[INDENT]Controller
[INDENT]VerwaltungController.php[/INDENT][/INDENT][/INDENT]
view
[INDENT]verwaltung
[INDENT]verwaltung
[INDENT]index.phtml[/INDENT][/INDENT][/INDENT]
Module.php
[/INDENT]
module.config.php
[PHP]return array(
‚controllers‘ => array(
‚invokables‘ => array(
‚Verwaltung\Controller\Verwaltung‘ => ‚Verwaltung\Controller\VerwaltungController‘,
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/verwaltung[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Verwaltung\Controller\Verwaltung',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
),
),
);[/PHP]
VerwaltungController.php
[PHP]<?php
namespace Verwaltung\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class VerwaltungController extends AbstractActionController
{
public function indexAction()
{
return new ViewModel();
}
}
[/PHP]
Module.php
[PHP]<?php
namespace Verwaltung;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
class Module
{
public function onBootstrap(MvcEvent $e)
{
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
}
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
}[/PHP]