Q:

What is the best prestashop-way to include tpl in AdminController?

I need interacts with a .tpl file in my adminController class, but when I try to do that, this error appears

Fatal error: Call to undefined method RiddlePageController::getCacheId()  in /home/USER/public_html/prestashop/modules/RiddleModule/controllers/admin/RiddlePage.php on line 48

This is my admin controller code:
class RiddlePageController extends AdminController {

public function __construct()
{
    $this->html = '';
    $this->display = 'view';
    $this->meta_title = $this->l('metatitle');
    $this->module = "RiddleModule";

    parent::__construct();
}

public function initContent()
{
    $this->postProcess();
    $this->show_toolbar = true;
    $this->display = 'view';
    $this->meta_title = $this->l('Modulo');
    parent::initContent();  
}

public function initToolBarTitle()
{
    $this->toolbar_title = $this->l('Titulo');
}

public function initToolBar()
{
    return true;
}

public function renderView() {
    $this->context->smarty->assign(
        array( 
            'img1' => "http://www.free-3dmodels.com/image/Flowers-3D-Model-3662994d.png",
            'img2' => "http://www.all3dmodel.com/Images/39.jpg"
            )
        );
    // in return have error "getCacheId"
    return $this->display(__FILE__, 'content.tpl', $this->getCacheId());
    // return "<b>This works fine!!</b>";

}

my tpl file have only {$img1} and {$img2} for testing.
Maybe I do all wrong, and this is not the best way to make in my own admin page.

A:

Your error is because the AdminController class doesn't have the getCacheId method.
To answer to your question you have to made some little fix.
First (extends ModuleAdminController not AdminController):

class AdminRiddlePageController extends ModuleAdminController
{
}
Then if you want to view your custom tpl, place a view.tpl file in:
prestashop/modules/RiddleModule/views/templates/admin/riddlepage/helpers/view/
or
prestashop/modules/RiddleModule/views/templates/admin/riddle_page/helpers/view/ (I don't remember well if the underscore is necessary)

And your renderView method should be like this:
public function renderView()
{
    /* Your code */

    /* Use this snippet to assign vars to smarty */
    $this->tpl_view_vars = array(
        'myvar' => 1,
        'secondvar' => true
    )
    return parent::renderView();
}

A:

As @TheDrot told us, the answer are in using $this->context->smarty->fetch(location), but not in renderList, but in the return statement  of renderView is OK and prestashop get the tpl file and load correctly the smarty variables. Ex:
public function renderView(){
    $this->context->smarty->assign(
        array( 
            'img1' => "http://www.free-3dmodels.com/image/Flowers-3D-Model-3662994d.png",
            'img2' => "http://www.all3dmodel.com/Images/39.jpg"
            )
        );

    return $this->context->smarty->fetch(_PS_MODULE_DIR_ . "RiddleModule/controllers/front/prueba.tpl");
}

The file location isn't important to load the TPL file in this case

