// optimization default template name
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8747 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -9,7 +9,7 @@ class AdminControllerCore extends Controller
|
|||||||
public $content_only = false;
|
public $content_only = false;
|
||||||
public $layout = 'index.tpl';
|
public $layout = 'index.tpl';
|
||||||
|
|
||||||
public $template = 'content.tpl';
|
public $template = '';
|
||||||
|
|
||||||
/** @var string Associated table name */
|
/** @var string Associated table name */
|
||||||
public $table;
|
public $table;
|
||||||
@@ -38,6 +38,16 @@ class AdminControllerCore extends Controller
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
// if this->template is empty,
|
||||||
|
// generate the filename from the classname, without "Controller" suffix
|
||||||
|
if (empty($this->template))
|
||||||
|
{
|
||||||
|
$tpl_name = substr(get_class($this), 0, -10).'.tpl';
|
||||||
|
$tpl_name[0] = strtolower($tpl_name[0]);
|
||||||
|
if (file_exists($this->context->smarty->template_dir.'/'.$tpl_name))
|
||||||
|
$this->template = $tpl_name;
|
||||||
|
}
|
||||||
|
|
||||||
$this->id = Tab::getIdFromClassName($this->className);
|
$this->id = Tab::getIdFromClassName($this->className);
|
||||||
$this->_conf = array(
|
$this->_conf = array(
|
||||||
1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'),
|
1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'),
|
||||||
@@ -147,18 +157,18 @@ class AdminControllerCore extends Controller
|
|||||||
$this->template = 'content.tpl';
|
$this->template = 'content.tpl';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->content = $this->context->smarty->fetch($this->template);
|
$content = $this->context->smarty->fetch($this->template);
|
||||||
|
|
||||||
if ($this->content_only)
|
if ($this->content_only)
|
||||||
echo $this->content;
|
echo $content;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign('warnings',$this->warnings);
|
$this->context->smarty->assign('warnings',$this->warnings);
|
||||||
$this->content = $this->context->smarty->fetch($this->template);
|
$content = $this->context->smarty->fetch($this->template);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->context->smarty->assign('content',$this->content);
|
$this->context->smarty->assign('content',$content);
|
||||||
$this->context->smarty->display($this->layout);
|
$this->context->smarty->display($this->layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user