Pagina 1 din 1

Tutorial configurare smarty pentru xampp

Scris: Vin Sep 28, 2012
de patricia
Am incercat urmatorii pasi specificati intr-un tutorial dar ceva e gresit ,la sfarsit imi spune ca nu exista Smarty.class.php.
Configuration:

1. Download the latest XAMPP version ;
2. Install at C: directory. (C:\xampp)
3. Create a new folder in xampp folder and rename it to smarty. (C:\xampp\smarty)
4. Download the latest Smarty version from: smarty.net/
5. Unzip the content of Smarty zip file to smarty folder. (C:\xampp\smarty)
6. Create two folders "templates_c" and "cache" inside it. (C:\xampp\smarty\templates_c and C:\xampp\smarty\cache)
7. Open php.ini file (C:\xampp\php\php.ini), search for Paths and Directories. At Windows part, replace the line

Cod: Selectaţi tot

include_path = ".;C:\xampp\php\pear\"
with

Cod: Selectaţi tot

include_path = ".;C:\xampp\php\pear\;C:\xampp\smarty\libs\"
8. Create a new folder in "htdocs" folder and rename it to "smarty". (C:\xampp\htdocs\smarty)
9. Create two folders "configs" and "templates" inside it. (C:\xampp\htdocs\smarty\configs and C:\xampp\htdocs\smarty\templates).
10. Smarty configuration is done. Create two scripts "index.php" and "index.tpl" to test Smarty template engine.
11. Place "index.php" inside C:\xampp\htdocs\smarty\ and index.tpl inside C:\xampp\htdocs\smarty\templates\

"index.php"

Cod: Selectaţi tot

<?php
// load Smarty library
require('Smarty.class.php');
$smarty = new Smarty;
$smarty-»template_dir = 'C:/xampp/htdocs/smarty/templates';
$smarty-»config_dir = 'C:/xampp/htdocs/smarty/config';
$smarty-»cache_dir = 'C:/xampp/smarty/cache';
$smarty-»compile_dir = 'C:/xampp/smarty/templates_c';
$smarty-»assign('name','Penguin !!');
$smarty-»display('index.tpl');
?>
"index.tpl"

Cod: Selectaţi tot

<html>
<body>
Hello, {$name}
<body>
<html>
12. Open the web browser and type in the URL: https://marplo.net/smarty

Tutorial configurare smarty pentru xampp

Scris: Sâm Sep 29, 2012
de MarPlo
Eroarea apare fiindca nu e corecta adresa de includere a clasei Smarty ('Smarty.class.php') in fisierul PHP, in raport cu directuorul unde e acesta si clasa.
Parerea mea e ca nu este necesara instalarea clasei Smarty direct in directorul "xampp" si apoi modificari de setari in "php.ini" (fiindca pe server la un "shared hosting" nu ai acces la "php.ini") , ci doar includerea /copierea directorulu "libs" cu Smarty direct in directorul unde e scriptul pt site; apoi se include fisierul cu clasa Smarty din "libs" in script.
Vezi exemplul de la pagina: Setari Instalare Smarty PHP .