Site em branco ao tentar usar o Smarty
Olá Pessoa estou tentando usar a classe Smarty, mas no resultado o meu template fica todo branco. Segui rigorasamente o site http://www.phpavancado.net/node/39.
- http://www.lucianofelli.com/teste contém os subdiretórios: cache, config, smarty, templates e templates_c.
- http://www.lucianofelli.com/teste/smarty contém os subdiretórios : demo, libs, misc e unit_test.
O Smarty.class.php está em http://www.lucianofelli.com/teste/smarty/libs
http://www.lucianofelli.com/teste/index.php
<?php
require_once "http://www.lucianofelli.com/teste/config/config.php";'>[http://www.lucianofelli.com/teste/config/config.php](http://www.lucianofelli.com/teste/config/config.php)";
$smarty->assign('nome', 'Pedro Faria');
$smarty->show();
$smarty->display("http://www.lucianofelli.com/teste/templates/index.tpl");'>[http://www.lucianofelli.com/teste/templates/index.tpl](http://www.lucianofelli.com/teste/templates/index.tpl)");
?>
http://www.lucianofelli.com/teste/config/config.php
<?php
define(SMARTY_DIR, 'http://www.lucianofelli.com/teste/smarty/libs/');
// Bibliotecas do Smarty
require_once SMARTY_DIR.'Smarty.class.php';
class Smarty_Site extends Smarty {
function Smarty_Site()
{
$sBaseDir = 'http://www.lucianofelli.com/teste/';
$this->Smarty();
$this->template_dir = $sBaseDir.'templates/';
$this->compile_dir = $sBaseDir.'templates_c/';
$this->config_dir = $sBaseDir.'config/';
$this->cache_dir = $sBaseDir.'cache/';
$this->caching = false;
$this->cache_lifetime = 0;
}
function show(){
preg_match('/^(.*)\.php$/', basename($_SERVER['SCRIPT_FILENAME']), $r);
$tela = $r[1];
$this->assign('tela', $tela.".tpl");
$this->display('fixo/site.tpl');
}
}
$smarty = new Smarty_Site;
?>
http://www.lucianofelli.com/teste/templates/index.tpl
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<title>Untitled Document</title>
<style type="text/css"><!--
body {
background-color: #999;
}-->
</style></head>
<body>
Meu nome é: {$nome}
resto do conteudo do site.
</body>
</html>Porque fica branco?
Discussão (1)
Carregando comentários...