Raintpl does not render HTML

Asked

Viewed 368 times

0

I’m having a problem using Raintpl, it doesn’t render HTML on the page.

//Função que eu pego os dados do banco e retorno.

public static function listAll()
{
    $sql = new Sql();
    return $sql->select("SELECT * FROM tb_users a INNER JOIN tb_persons b 
    USING(idperson)");
}


-----------------------------------------------------------------

//Rota responsável por mandar os dados para o template users.

$app->get('/admin/users', function(){
User::verifyLogin();
$users = User::listAll();
$page = new PageAdmin();
$page->setTpl("users", array("users"=>$users));
});

-----------------------------------------------------------------

//Funções responsáveis por chamar o template e jogar os dados nele.


private function setData($data = array())
{
    foreach ($data as $key => $value) {
        $this->tpl->assign($key, $value);
    }
}
public function setTpl($name, $data = array(), $returnHTML = false)
{
    $this->setData($data);
    return $this->tpl->draw($name, $returnHTML);
}

-----------------------------------------------------------------

//O Template onde deveria ser renderizado o HTML

{loop="$users"}
            <tr>
              <td>{$value.iduser}</td>
              <td>{$value.desperson}</td>
              <td>{$value.desemail}</td>
              <td>{$value.deslogin}</td/>
              <td>{if="$value.inadmin == 1"}Sim{else}Não{/if}</td>
            <td>
                <a href="/admin/users/update/{$value.iduser}"><button class="btn btn-xs btn-primary">Editar</button></a>
                <a href="/admin/users/delete/{$value.iduser}"><button class="btn btn-xs btn-danger">Excluir</button></a>
            </td>
          </tr>
          {/loop} 

1 answer

0

In the configuration parameters you should inform that "auto_escape" => false, being more or less like this:

    // config
    $config = array(
        "tpl_dir"       => $_SERVER['DOCUMENT_ROOT'].$tpl_dir,
        "cache_dir"     => $_SERVER['DOCUMENT_ROOT']."/views/views-cache/",
        "auto_escape"   => false,
        "debug"         => false
    );

Browser other questions tagged

You are not signed in. Login or sign up in order to post.