Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
CakeEmail: create request object before rendering
Closes #2931
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1441,6 +1441,12 @@ protected function _renderTemplates($content) { | |
$View = new $viewClass(null); | ||
$View->viewVars = $this->_viewVars; | ||
$View->helpers = $this->_helpers; | ||
if (!$request = Router::getRequest(true)) { | ||
$request = new CakeRequest('/', false); | ||
$request->base = ''; | ||
$request->here = $request->webroot = '/'; | ||
} | ||
$View->request = $request; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ADmad
Member
|
||
|
||
list($templatePlugin, $template) = pluginSplit($this->_template); | ||
list($layoutPlugin, $layout) = pluginSplit($this->_layout); | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* | ||
* PHP 5 | ||
* | ||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) | ||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://www.cakefoundation.org) | ||
* | ||
* Licensed under The MIT License | ||
* Redistributions of files must retain the above copyright notice. | ||
* | ||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://www.cakefoundation.org) | ||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project | ||
* @since CakePHP(tm) v 2.1 | ||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License | ||
*/ | ||
|
||
echo $this->Html->image('image.gif', array( | ||
'alt' => 'cool image', | ||
'width' => 100, | ||
'height' => 100, | ||
'fullBase' => true, | ||
)); |
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
I was wondering if it would be better to have this check inside the View class's constructor. Helper methods depend on the View having a request object and there may be other places in the code that don't pass a controller object to the View's constructor.