Created
October 26, 2012 08:38
-
-
Save asgrim/3957662 to your computer and use it in GitHub Desktop.
every page
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
<?php | |
namespace EveryPage\Controller\Plugin; | |
use Zend\ServiceManager\ServiceLocatorInterface; | |
use Zend\ServiceManager\ServiceLocatorAwareInterface; | |
use Zend\Mvc\Controller\Plugin\AbstractPlugin; | |
class EveryPage extends AbstractPlugin implements ServiceLocatorAwareInterface | |
{ | |
protected $serviceLocator; | |
public function setServiceLocator(ServiceLocatorInterface $serviceLocator) | |
{ | |
$this->serviceLocator = $serviceLocator; | |
return $this; | |
} | |
/** | |
* (non-PHPdoc) | |
* @see Zend\ServiceManager.ServiceLocatorAwareInterface::getServiceLocator() | |
* @return ServiceLocatorInterface | |
*/ | |
public function getServiceLocator() | |
{ | |
return $this->serviceLocator; | |
} | |
public function __invoke() | |
{ | |
$sometext = "If you see this, EveryPage ran!"; | |
//$this->getServiceLocator()->get('view')->sometext = $sometext; | |
#if ($this->getServiceLocator()->has('viewhelpermanager')) | |
{ | |
var_dump($this->getServiceLocator()->get('viewhelpermanager')); | |
} | |
var_dump($this->getServiceLocator()); | |
// @todo How can I put stuff in the view from here? | |
// @todo If I access the controller (using $this->getController()) it's not the right instance | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment