index.php <?php define("APP_BASEDIR", dirname(__FILE__)); require_once('includes/configure.php'); //setting parameters require_once('includes/config_db.php'); //setting data base $dao = new SocioDAO(); $lista = $dao->listar(); $tpl = new Plantilla(); $tpl->assign("lista", $lista); $tpl->display("principal.tpl.php"); ?> PHP: configure.php <?php //---- LIBRARYS ----- // define('SMARTY_BASEFILE', APP_BASEDIR . '/lib/Smarty-2.6.14/Smarty.class.php'); //define('SMARTY_BASEFILE', APP_BASEDIR . '/lib/smarty-3.1.12/smarty.class.php'); define('ADODB_BASEFILE', APP_BASEDIR . '/lib/adodb511/adodb.inc.php'); //---- PATH OBJECTS require_once APP_BASEDIR . "/clases/vo/SocioVO.class.php"; require_once APP_BASEDIR . "/clases/dao/SocioDAO.class.php"; require_once APP_BASEDIR . "/clases/util/ConexionDB.class.php"; require_once APP_BASEDIR . "/clases/util/Plantilla.class.php"; //---- SETTING ini_set('session.gc_maxlifetime','1800'); // 30 minutos ini_set('error_reporting', 'E_ALL'); session_start(); ?> PHP: SocioDAO.class.php <?php class SocioDAO { function __construct() { } function listar(){ $query = "SELECT codigo, apepat, apemat, nombres, condicion FROM socios"; $BD = new ConexionDB(); $recordSet = $BD->dbLink->Execute($query); if (!$recordSet){ Debug::println("No se pudo ejecutar la consulta listar: " . $query); return false; } $socios = array(); while($fila=$recordSet->FetchRow()) { $socios[] = new SocioVO($fila['codigo'], $fila['apepat'], $fila['apemat'],$fila['nombres'], $fila['condicion']); } return $socios; } } ?> PHP: SocioVO.class.php <?php class SocioVO { var $idCodigo; var $apepat; var $apemat; var $nombres; var $condicion; function SocioVO($c, $ap, $am, $n, $cn){ $this->idCodigo = $c; $this->apepat = $ap; $this->apemat = $am; $this->nombres = $n; $this->condicion = $cn; } function toString(){ print '<pre>'; print 'Codigo: '. $this->idCodigo; print 'Apellido Paterno: '. $this->apepat; print 'Apellido Materno: '. $this->apemat; print 'Nombres: '. $this->nombres; print 'Condicion: '. $this->condicion; print '</pre>'; } } ?> PHP: principal.tpl.php <html> <table class=estilotabla cellSpacing=4 cellPadding=4 width=100% height=18> <form action="productos.eliminar.php" method="post"> <tr> <td class=estilocelda></th> <td class=estilocelda>Codigo</th> <td class=estilocelda>Ap.Paterno</th> <td class=estilocelda>Ap.Materno</th> <td class=estilocelda>Nombres</th> <td class=estilocelda>Status</th> </tr> {section name=i loop=$lista} <tr> <td>{$lista[i]->Codigo}</td> <td>{$lista[i]->idCodigo}</td> <td>{$lista[i]->apepat}</td> <td>{$lista[i]->apemat}</td> <td>{$lista[i]->nombres}</td> <td>{$lista[i]->condicion}</td> </tr> {/section} </table> <br/> </html> PHP: When I use Smarty 2.6.14 library it works. But I se Smarty 3.1.12... does not work. Why? Can somebody help me? Thanks.
Shows nothing. When is like this: define('SMARTY_BASEFILE', APP_BASEDIR . '/lib/Smarty-2.6.14/Smarty.class.php'); //define('SMARTY_BASEFILE', APP_BASEDIR . '/lib/smarty-3.1.12/smarty.class.php'); PHP: But, when is like this: //define('SMARTY_BASEFILE', APP_BASEDIR . '/lib/Smarty-2.6.14/Smarty.class.php'); define('SMARTY_BASEFILE', APP_BASEDIR . '/lib/smarty-3.1.12/smarty.class.php'); PHP: Shows nothing.
smarty vs Smarty /on two places in second statement/ - is it case sensitive? I am not sure, but you may try
hhmm... you want to say me change: SMARTY_BASEFILE by smarty_basefile and APP_BASEDIR by app_basedir ??
[URL="http://www.php.net/define"][COLOR=#990000]define[/COLOR][/URL][COLOR=#009900]([/COLOR][COLOR=#0000ff]'SMARTY_BASEFILE'[/COLOR][COLOR=#339933],[/COLOR] APP_BASEDIR [COLOR=#339933].[/COLOR] [COLOR=#0000ff]'/lib/[/COLOR][COLOR=#ff0000]Smarty[/COLOR][COLOR=#0000ff]-2.6.14/[/COLOR][COLOR=#ff0000]Smarty[/COLOR][COLOR=#0000ff].class.php'[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#666666][I]//define('SMARTY_BASEFILE', APP_BASEDIR . '/lib/[/I][/COLOR][COLOR=#ff0000][I]smarty[/I][/COLOR][COLOR=#666666][I]-3.1.12/[/I][/COLOR][COLOR=#ff0000][I]smarty[/I][/COLOR][COLOR=#666666][I].class.php'); [/I][/COLOR] Code (markup): Are the directory and file names actually like this? Smarty-2.6.14 but smarty-3.1.12? Or are they both Smarty or smarty? Case counts in a *nix server.