-
-
Save Hounddog/3923157 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?= $this->doctype(); ?> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<?php | |
echo $this->headTitle('ZF2 '. $this->translate('Skeleton Application')) | |
->setSeparator(' - ')->setAutoEscape(false), PHP_EOL; | |
echo $this->headMeta()->appendName('viewport', 'width=device-width, initial-scale=1.0'), PHP_EOL; | |
echo $this->headLink(array( | |
'rel' => 'shortcut icon', | |
'type' => 'image/vnd.microsoft.icon', | |
'href' => $this->basePath() . '/images/favicon.ico' | |
)) | |
->prependStylesheet($this->basePath() . '/css/bootstrap-responsive.min.css') | |
->prependStylesheet($this->basePath() . '/css/style.css') | |
->prependStylesheet($this->basePath() . '/css/bootstrap.min.css'); | |
?> | |
</head> | |
<body> | |
<div class="navbar navbar-fixed-top"> | |
<div class="navbar-inner"> | |
<div class="container"> | |
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
</a> | |
<a class="brand" href="<?= $this->url('home'); ?>"><?= $this->translate('Skeleton Application'); ?></a> | |
<div class="nav-collapse"> | |
<?php | |
echo $this->navigation('admin_navigation') | |
->menu() | |
->setUlClass('nav') | |
->setMaxDepth(0) | |
->setRenderInvisible(false), PHP_EOL; | |
?> | |
</div><!-- .nav-collapse --> | |
</div> | |
</div> | |
</div> | |
<div class="container"> | |
<?= $this->content; ?> | |
<hr> | |
<footer> | |
<p>© 2012 Chuck Norris. <?php echo $this->translate('All rights reserved.') ?></p> | |
</footer> | |
</div> <!-- /container --> | |
<?php | |
echo $this->inlineScript(); | |
echo $this->headScript() | |
->prependFile($this->basePath() . '/js/html5.js', 'text/javascript', array('conditional' => 'lt IE 9',)) | |
->prependFile('//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js'), PHP_EOL; | |
?> | |
</body> | |
</html> |
This file contains hidden or 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
<p>Below are some helpful links</p> | |
<?php | |
#Zend\Debug\Debug::dump($this->navigation('admin_navigation')->getContainer()->getPages()) . '<br /><br />'; | |
#Zend\Debug\Debug::dump($this->navigation('user_navigation')->getContainer()->getPages()); die(); | |
#echo get_class($this->navigation('admin_navigation')->getContainer())->getPages(), '<br />'; | |
#cho get_class($this->navigation('user_navigation')->getContainer())->getPages(); | |
#die(); | |
echo $this->navigation('user_navigation') | |
->menu() | |
->setUlClass('subnav') | |
->setMaxDepth(0) | |
->setRenderInvisible(false) | |
->render(), PHP_EOL; |
This file contains hidden or 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
<?php | |
namespace User\Controller; | |
use Zend\Mvc\Controller\AbstractActionController, | |
Zend\View\Model\ViewModel, | |
Zend\Debug\Debug; | |
class IndexController extends AbstractActionController | |
{ | |
/** | |
* UserTable instance | |
* @ignore | |
*/ | |
protected $_model; | |
/** | |
* (non-PHPdoc) | |
* @see \Zend\Mvc\Controller\AbstractActionController::indexAction() | |
*/ | |
public function indexAction() | |
{ | |
#$container = $this->getServiceLocator()->get('user_navigation'); | |
#Debug::dump($container); die(); | |
#return new ViewModel(array('subnav' => $container)); | |
return new ViewModel(); | |
} | |
} |
This file contains hidden or 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
<?php | |
return array( | |
'controllers' => array( | |
'invokables' => array( | |
'User\Controller\Index' => 'User\Controller\IndexController', | |
), | |
), | |
// The following section is new and should be added to your file | |
'router' => array( | |
'routes' => array( | |
'user' => array( | |
'type' => 'segment', | |
'options' => array( | |
'route' => '/user[/:action][/:id]', | |
'constraints' => array( | |
'action' => '[a-zA-Z][a-zA-Z0-9_-]*', | |
'id' => '[0-9]+', | |
), | |
'defaults' => array( | |
'controller' => 'User\Controller\Index', | |
'action' => 'index', | |
) | |
) | |
) | |
) | |
), | |
'navigation' => array( | |
'user' => array( | |
'change-password' => array( | |
'label' => 'Change Password', | |
'route' => 'user', | |
'action' => 'change-password' | |
), | |
'manage-avatar' => array( | |
'label' => 'Manage Avatar', | |
'route' => 'user', | |
'action' => 'manage-avatar' | |
) | |
) | |
), | |
'view_manager' => array( | |
'template_path_stack' => array( | |
'user' => __DIR__ . '/../view', | |
), | |
) | |
); |
This file contains hidden or 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
<?php | |
namespace User; | |
use Zend\Mvc\ModuleRouteListener, | |
Zend\ModuleManager\ModuleManager, | |
Zend\Mvc\MvcEvent, | |
Zend\Debug\Debug as Debug; | |
class Module | |
{ | |
/** | |
* Module bootstrap | |
* @param MvcEvent $e | |
*/ | |
public function onBootstrap(MvcEvent $e) | |
{ | |
$e->getApplication()->getServiceManager()->get('translator'); | |
$eventManager = $e->getApplication()->getEventManager(); | |
$moduleRouteListener = new ModuleRouteListener(); | |
$moduleRouteListener->attach($eventManager); | |
} | |
/** | |
* Use ServiceManager to inject user into controller | |
* @return multitype:multitype:NULL |\Admin\UserTable | |
*/ | |
public function getServiceConfig() | |
{ | |
return array( | |
'factories' => array( | |
'user_navigation' => 'User\Navigation\Service\UserNavigationFactory' | |
) | |
); | |
} | |
/** | |
* get config | |
*/ | |
public function getConfig() | |
{ | |
return include __DIR__ . '/config/module.config.php'; | |
} | |
/** | |
* get autoloader config | |
* | |
* @return multitype:multitype:multitype:string | |
*/ | |
public function getAutoloaderConfig() | |
{ | |
return array( | |
'Zend\Loader\StandardAutoloader' => array( | |
'namespaces' => array( | |
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, | |
) | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment