Why does not work?

Discussion in 'PHP' started by piropeator, Oct 31, 2012.

  1. #1
    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.
     
    piropeator, Oct 31, 2012 IP
  2. plussy

    plussy Peon

    Messages:
    152
    Likes Received:
    5
    Best Answers:
    9
    Trophy Points:
    0
    #2
    Have you checked your error log?
    what errors do you see?
     
    plussy, Oct 31, 2012 IP
  3. piropeator

    piropeator Well-Known Member

    Messages:
    194
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #3
    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.
     
    piropeator, Oct 31, 2012 IP
  4. showdown

    showdown Active Member

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    71
    #4
    smarty vs Smarty /on two places in second statement/ - is it case sensitive? I am not sure, but you may try
     
    showdown, Nov 1, 2012 IP
  5. piropeator

    piropeator Well-Known Member

    Messages:
    194
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #5
    hhmm... you want to say me change: SMARTY_BASEFILE by smarty_basefile and APP_BASEDIR by app_basedir ??
     
    piropeator, Nov 3, 2012 IP
  6. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #6
    
    
    [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.
     
    Rukbat, Nov 3, 2012 IP