Skip to content
Permalink
Browse files

Refactoring to use TemplateTask

  • Loading branch information...
markstory committed May 30, 2009
1 parent f1821f5 commit fb2be781f2f513db8594e621597966a88164a198
Showing with 9 additions and 16 deletions.
  1. +9 −16 cake/console/libs/tasks/view.php
@@ -45,7 +45,7 @@ class ViewTask extends Shell {
* @var array
* @access public
*/
var $tasks = array('Project', 'Controller');
var $tasks = array('Project', 'Controller', 'Template');
/**
* path to VIEWS directory
*
@@ -175,6 +175,7 @@ function all() {
}
}
}
/**
* Handles interactive baking
*
@@ -353,29 +354,21 @@ function getContent($template = null, $vars = null) {
$action = $template;
$template = 'form';
}
$loaded = false;
foreach ($this->Dispatch->shellPaths as $path) {
$templatePath = $path . 'templates' . DS . 'views' . DS .Inflector::underscore($template).'.ctp';
if (file_exists($templatePath) && is_file($templatePath)) {
$loaded = true;
break;
}
}
if (!$vars) {
$vars = $this->__loadController();
}
if ($loaded) {
extract($vars);
ob_start();
ob_implicit_flush(0);
include($templatePath);
$content = ob_get_clean();
return $content;
$this->Template->set($vars);
$output = $this->Template->generate('views', $template);
if (!empty($output)) {
return $output;
}
$this->hr();
$this->err(sprintf(__('Template for %s could not be found', true), $template));
return false;
}
/**
* Displays help contents
*

0 comments on commit fb2be78

Please sign in to comment.
You can’t perform that action at this time.