Foros del Web » Programando para Internet » PHP »

Configurar Smarty

Estas en el tema de Configurar Smarty en el foro de PHP en Foros del Web. Estoy tratando de configurar Smarty, yestoy siguiendo las intrucciones que hay en el manual de instalacion. peo hago la siguiente prueba y me arroja un ...
  #1 (permalink)  
Antiguo 11/04/2009, 07:35
 
Fecha de Ingreso: abril-2009
Mensajes: 29
Antigüedad: 15 años
Puntos: 0
Configurar Smarty

Estoy tratando de configurar Smarty, yestoy siguiendo las intrucciones que hay en el manual de instalacion. peo hago la siguiente prueba y me arroja un error que me tiene ya con dolor de cabeza, pues he probado todas las indicaciones y nada. el codigo es:

<?php
define('SMARTY_DIR', 'C:\smarty\libs');
require(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty;
?>

El error es:

PHP Warning: require(C:\smarty\libsSmarty.class.php) [function.require]: failed to open stream: No such file or directory in C:\inetpub\wwwroot\SmartyTest.php on line 3 PHP Fatal error: require() [function.require]: Failed opening required 'C:\smarty\libsSmarty.class.php' (include_path='.:c;\smarty\libs') in C:\inetpub\wwwroot\SmartyTest.php on line 3

Yo isntale el Smarty en C:\smarty

Agradezco me den una manita
  #2 (permalink)  
Antiguo 11/04/2009, 07:50
Avatar de grindcode  
Fecha de Ingreso: abril-2009
Ubicación: Palma de Mallorca
Mensajes: 30
Antigüedad: 15 años
Puntos: 5
Respuesta: Configurar Smarty

Prueba con esto:

require(SMARTY_DIR . '\Smarty.class.php');
  #3 (permalink)  
Antiguo 11/04/2009, 08:19
isra00
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Configurar Smarty

Hombre lo suyo es que pongas Smarty en el directorio público, será menos propenso a errores.
  #4 (permalink)  
Antiguo 11/04/2009, 08:52
 
Fecha de Ingreso: abril-2009
Mensajes: 29
Antigüedad: 15 años
Puntos: 0
Respuesta: Configurar Smarty

Bueno, ya no me da error el archivo de prueba, pero ahora estoy siguiendo el tutorial de la pagina de: Smarty y no mefunciona.

tengo este codigo:

index.php

<?php

/**
* Project: Guestbook Sample Smarty Application
* Author: Monte Ohrt <monte [AT] ohrt [DOT] com>
* Date: March 14th, 2005
* File: index.php
* Version: 1.0
*/

// define our application directory
define('GUESTBOOK_DIR', '/guestbook/');
// define smarty lib directory
define('SMARTY_DIR', 'C:\smarty\libs');
require(SMARTY_DIR . '\Smarty.class.php');
// include the setup script
include(GUESTBOOK_DIR . 'libs/guestbook_setup.php');

// create guestbook object
$guestbook =&new Guestbook;

// set the current action
$_action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';

switch($_action) {
case 'add':
// adding a guestbook entry
$guestbook->displayForm();
break;
case 'submit':
// submitting a guestbook entry
$guestbook->mungeFormData($_POST);
if($guestbook->isValidForm($_POST)) {
$guestbook->addEntry($_POST);
$guestbook->displayBook($guestbook->getEntries());
} else {
$guestbook->displayForm($_POST);
}
break;
case 'view':
default:
// viewing the guestbook
$guestbook->displayBook($guestbook->getEntries());
break;
}

?>


y me da error:

PHP Warning: include(/guestbook/libs/guestbook_setup.php) [function.include]: failed to open stream: No such file or directory in C:\inetpub\wwwroot\Guestbook\index.php on line 17 PHP Warning: include() [function.include]: Failed opening '/guestbook/libs/guestbook_setup.php' for inclusion (include_path='.:c;\smarty\libs') in C:\inetpub\wwwroot\Guestbook\index.php on line 17 PHP Fatal error: Class 'Guestbook' not found in C:\inetpub\wwwroot\Guestbook\index.php on line 20


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

la revise en el archivo :guestbook_setup.php y no se donde esta el error.

PHP Notice: Use of undefined constant GUESTBOOK_DIR - assumed 'GUESTBOOK_DIR' in C:\inetpub\wwwroot\Guestbook\libs\guestbook_setup. php on line 11 PHP Warning: require(GUESTBOOK_DIRlibs/sql.lib.php) [function.require]: failed to open stream: No such file or directory in C:\inetpub\wwwroot\Guestbook\libs\guestbook_setup. php on line 11 PHP Fatal error: require() [function.require]: Failed opening required 'GUESTBOOK_DIRlibs/sql.lib.php' (include_path='.:c;\smarty\libs') in C:\inetpub\wwwroot\Guestbook\libs\guestbook_setup. php on line 11

no se, si alguno de ustedes me pueden indicar donde esta el error...
  #5 (permalink)  
Antiguo 11/04/2009, 08:53
 
Fecha de Ingreso: abril-2009
Mensajes: 29
Antigüedad: 15 años
Puntos: 0
Respuesta: Configurar Smarty

guestbook_setup.php :

<?php

/**
* Project: Guestbook Sample Smarty Application
* Author: Monte Ohrt <monte [AT] ohrt [DOT] com>
* Date: March 14th, 2005
* File: guestbook_setup.php
* Version: 1.0
*/

require(GUESTBOOK_DIR . 'libs/sql.lib.php');
require(GUESTBOOK_DIR . 'libs/guestbook.lib.php');
//require(SMARTY_DIR . 'Smarty.class.php');
require('Smarty.class.php');
require('DB.php'); // PEAR DB

// database configuration
class GuestBook_SQL extends SQL {
function GuestBook_SQL() {
// dbtype://user:pass@host/dbname
$dsn = "mysql://guestbook:foobar@localhost/GUESTBOOK";
$this->connect($dsn) || die('could not connect to database');
}
}

// smarty configuration
class Guestbook_Smarty extends Smarty {
function Guestbook_Smarty() {
$this->template_dir = GUESTBOOK_DIR . 'templates';
$this->compile_dir = GUESTBOOK_DIR . 'templates_c';
$this->config_dir = GUESTBOOK_DIR . 'configs';
$this->cache_dir = GUESTBOOK_DIR . 'cache';
}
}

?>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:20.