Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/06/2008, 15:02
iozk
 
Fecha de Ingreso: mayo-2008
Mensajes: 499
Antigüedad: 16 años, 9 meses
Puntos: 1
ayuda con esto explicar

Instalación de Smarty en Windows

Este documento asume que su servidor web y php5 está en marcha.

Descarga Smarty - http://smarty.php.net

Instalación - Windows, IIS y Apache, PHP5
Extracto de archivos, cambiar el nombre de Smarty.xxx a smarty (sugieren fuera de su raíz www!)
Ejemplo: d: \ smarty
Ejecutar phpinfo.php para averiguar su ubicación de php.ini
Editar php.ini 's include_path y añadir la ubicación de la carpeta libs.
ejemplo: include_path = ".; d: \ smarty \ libs»
Reinicie IIS / Apache
Configuración de estas dos carpetas dentro de su raíz www:
(wwwroot) / smarty / plantillas (aquí es donde sus plantillas ir)
(wwwroot) / smarty / configs

Configuración de estas dos carpetas fuera de su raíz www:
d: / smarty / templates_c
d: / smarty / cache

Configuración de las opciones de seguridad para el servidor web a escribir a estas cuatro carpetas

En (wwwroot) y crear en index.php (wwwroot) / smarty / templates / index.tpl con el siguiente código:

index.php:
<? PHP

/ / Biblioteca de Smarty carga
requieren ( 'Smarty.class.php');

$ smarty = new Smarty;

$ smarty-> template_dir = 'd: / inetpub / wwwroot / smarty / plantillas ";
$ smarty-> config_dir = 'd: / inetpub / wwwroot / smarty / config';
$ smarty-> cache_dir = 'd: / smarty / smarty_cache';
$ smarty-> compile_dir = 'd: / smarty / smarty_templates_c';

$ smarty-> asignar ( 'nombre', 'pez chico');

$ smarty-> display ( 'index.tpl');
>

index.tpl
<html>
<body>
Hello, ($ name)!
</ body>
</ HTML>

Ahora abre index.php en el navegador web (pedido de su servidor web)

http://webserver/index.php

Puede trabajar a cabo esta referencia a un script / clase:
smarty_connect.php:
<? PHP

/ / Biblioteca de Smarty carga
requieren ( 'Smarty.class.php');

smarty_connect clase se extiende Smarty
(
smarty_connect función ()
(
/ / Class Constructor.
/ / Estos automáticamente conjunto con cada nueva instancia.

De dólares este-> Smarty ();

de dólares este-> template_dir = 'd: / inetpub / wwwroot / smarty / plantillas ";
de dólares este-> config_dir = 'd: / inetpub / wwwroot / smarty / config';
De dólares este-> compile_dir = 'd: / smarty / templates_c';
De dólares este-> cache_dir = 'd: / smarty / cache';

De dólares este-> asignar ( 'app_name', 'Intranet');
)
)
>

index.php:
<? PHP

requieren ( 'smarty_connect.php');

$ smarty = new smarty_connect;

$ smarty-> asignar ( 'nombre', 'Ned');

$ smarty-> display ( 'index.tpl');
>

index.tpl:
<html>
<body>
Hello, ($ name)!
</ body>
</ HTML>