Configuration:
1. Download the latest XAMPP version from http://www.apachefriends.org/
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 http://www.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
- include_path = ".;C:\xampp\php\pear\"
- with
- 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
- <?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
- <html>
<body>
Hello, {$name}
<body>
<html>
12. Open the web browser and type in the URL http://localhost/smarty
Documentation: http://www.smarty.net/docs.php
Reference: http://news.php.net/php.smarty.dev/2703
52 comments:
didnt work for me, getting this error code
Parse error: parse error in C:\xampp\htdocs\index.php on line 5
same :'(
Is not work,any body know to solve this problem
gak jalan d komputer saya...apakah ada solusi....problemnya juga sama
7. Open php.ini file (C:\xampp\php\php.ini), search for Paths and Directories. At Windows part, replace the line
====
7. Open php.ini file (C:\xampp\apache\bin\php.ini)
it works, thanks
Change ->> for ->
----------------------
$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');
$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');
Can you Help me.. It's not working for me. and I don't how to do it, it's my first time to try the smarty configuration.
this is the (C:\xampp\php\php.ini),
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
;
; PHP's default setting for include_path is ".;/path/to/php/pear"
; http://php.net/include-path
include_path = ".;C:\xampp\php\pear\;C:\xampp\smarty\libs\"
Parse error: parse error in C:\xampp\htdocs\index.php on line 5
This the error.
i'll try to execute this ==== , b ut it the same error.
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
;include_path ==== ".;c:\php\includes"
;
; PHP's default setting for include_path is ".;/path/to/php/pear"
; http://php.net/include-path
include_path = ".;C:\xampp\php\pear\;C:\xampp\smarty\libs\"
Can you help me. what is wrong of this execution?
By the way I'm Darryl, I want to learn smarty combination of php.
Please help me.
I have gone through the steps provided here to install smarty.
After installation I restarted my apache server too.
Now I am getting an error like:
Warning: Smarty error: unable to read resource: "index.tpl" in C:\xampplite\smarty\libs\Smarty.class.php on line 1093
Can you please help me?
Warning: require(Smarty.class.php) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\smarty\index.php on line 3
Fatal error: require() [function.require]: Failed opening required 'Smarty.class.php' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\smarty\index.php on line 3
I am getting above error
i change the include_path but it still not loading smarty library...
plz help me in this...
Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\Smarty\index.php on line 5
$smarty-»template_dir = 'C:/xampp/htdocs/smarty/templates';
The -> double >> sign is creating error kindly remove it.
Thanks.Work perfectly for me after replacing >> with ->
I am getting this error :
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'index.tpl'' in C:\xampp\Smarty\libs\sysplugins\smarty_internal_template.php:163 Stack trace: #0 C:\xampp\Smarty\libs\sysplugins\smarty_internal_template.php(550): Smarty_Internal_Template->isExisting(true) #1 C:\xampp\Smarty\libs\Smarty.class.php(338): Smarty_Internal_Template->getRenderedTemplate() #2 C:\xampp\Smarty\libs\Smarty.class.php(382): Smarty->fetch('index.tpl', NULL, NULL, NULL, true) #3 C:\xampp\htdocs\smarty\index.php(16): Smarty->display('index.tpl') #4 {main} thrown in C:\xampp\Smarty\libs\sysplugins\smarty_internal_template.php on line 163
pls help
Thanks for your great post. I found it helpfull to install smarty in my pc
Thank you! This hepled me a lot!
my solution are :
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');
?>
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');
?>
this textbox eat my codes head
why?
<?php
$SMARTY_DIR='C:/xampp/smarty/libs/';
require($SMARTY_DIR.'Smarty.class.php');
$smarty = new Smarty;
thanks in my system smarty running well...
Hi,
i have upload all smarty file in in server by FTP .Then show that error
Fatal error: require_once() [function.require]: Failed opening required '../main.php' (include_path='.;./includes;./pear') in C:\Inetpub\vhosts\kormanmd.perfectyourself.net\httpdocs\index.php on line 6
Help please
Its good for beginner. really I got too must help
It works!!! after you change the sign, explainned above, you may say to program how to find the 'Smarty.class.php'. Following the right directorie it shoud be:
require('C:xampp/smarty/libs/Smarty.class.php');
not working
Very nice example of doing/installing with xampp
Thanks
yeah it's working.... thank sir
Add below line in index.php at 3rd line....
require($SMARTY_DIR.'Smarty.class.php');
replace ->> with ->
nice post on smarty config..
good work...
it will definitely help beginners...
Nice One!!! I Configured successfully.
Thank you!!!!! :-D
Hi..
I like your product & it's information....
Give us some more details about your product...
Thank you....
Weighing Scale | Digital Scale
Notice: Undefined variable: SMARTY_DIR in C:\xampp\htdocs\smarty\index.php on line 3
Warning: require(Smarty.class.php): failed to open stream: No such file or directory in C:\xampp\htdocs\smarty\index.php on line 3
Fatal error: require(): Failed opening required 'Smarty.class.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\smarty\index.php on line 3
goveing theses errors please help!!!!!!!!!!!!!!!
Such helping tutorial!! Thanx a lot!!
got it correct.. thank u.. :)
I done it.....Good tutorial to configure smarty.....great...
Warning: require(Smarty.class.php): failed to open stream: No such file or directory in C:\xampp\htdocs\smarty\index.php on line 3
Fatal error: require(): Failed opening required 'Smarty.class.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\smarty\index.php on line 3
Thank You! You are the BEST!
it's work. Thank you so much.
Warning: require(Smarty.class.php): failed to open stream: No such file or directory in C:\xampp\htdocs\smarty\index.php on line 4
Fatal error: require(): Failed opening required 'Smarty.class.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\smarty\index.php on line 4
Anybody help me on the above error. i m beginner on Smarty ....
Very nice post, impressive. its quite different from other posts. Thanks for sharing.
buy weighing scale online
Easy Steps To config Thanks.
guys just put that line in ".;C:\xampp\php\pear\;C:\xampp\smarty\libs\" on the path and directories. i had the same problem just change it it will work on windows. i have solved it..
Warning: require(Smarty.class.php): failed to open stream: No such file or directory in C:\xampp\htdocs\smarty\index.php on line 3
Fatal error: require(): Failed opening required 'Smarty.class.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\smarty\index.php on line 3
Hi, i got this problem and i don't know what to do. My php file do not show my tpl, instead it show the php file as text file.
thanks for sharing informative information about weighbridge for my business. it is very important article Tank Weighing System for me.
Can you help me I;m getting this error :
Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\smarty\index.php on line 5
hai can u send me class.php file
dynamometers
load cell
https://www.ron-crane-scales.com/
Eilon Engineering specializes in the manufacture of crane scales, dynamometers, and load cell. We manufacturing high-quality digital crane scales, dynamometers, and load cell with the last 40 Year experience.
Here's a working example: Just make sure you point the right path for 'Smarty.class.php'
<?php
// load Smarty library
require('C:\xampp\smarty\libs\Smarty.class.php');
$smarty = new Smarty;
$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');
?>
Post a Comment