Search Results

Search found 2 results on 1 pages for 'moteutsch'.

Page 1/1 | 1 

  • ZF: Url View Helper Acting Strangely

    - by moteutsch
    I have the following route defined: $route = new Zend_Controller_Router_Route( 'users/:id', array( 'controller' => 'users', 'action' => 'profile', 'id' => '' ) ); When I am on the page via the shortened URL (localhost/users/someuser), the URLs defined in the layout file all link to "localhost/users". Here is the code in the layout: <li><a href="<?php echo $this->url(array('controller' => 'index'), null, true); ?>">Home</a></li> <li><a href="<?php echo $this->url(array('controller' => 'search'), null, true); ?>">Search</a></li> <!-- etc. --> How can I fix the code so that the links in the layout file point to the correct URLs?

    Read the article

  • Injecting single-use object into class

    - by moteutsch
    I have the following code: <?php class X { public function do($url) { $httpRequest = new \HttpRequest\Curl($url, $this->getOptions()); $httpRequest->fire(); // etc. } // ... } In order to be able to unit test this class, I'd like to inject a mocked HttpRequest class. One way to do this would be as follows: <?php class X { private $httpRequestClass; public function __construct($httpRequestClass = '\HttpRequest\Curl') { $this->httpRequestClass = $httpRequestClass; } public function do($url) { $httpRequest = new $this->httpRequestClass($url, $this->getOptions()); $httpRequest->fire(); // etc. } // ... } But this doesn't seem right. Any other ideas?

    Read the article

1