Page 1 of 1

Samrty Templation Installtion and Configuration

Posted: Tue Sep 13, 2005 10:14 am
by lisamarie_tt
I am having some difficulties getting smarty to work.

1. I'm not certain where to place the smarty folder.
2. I'm not sure where i have to create the templates, templates_c, cahce and configs folders. Or if I need to create them at all.
3. I'm not sure as to what configurations are to be done to the php.config file and php.ini file if any.

I looked at the online installation help files but i am still stuck. For my current setup I have extracted the Smary files into a Smarty folder in htdocs folder.
I created the templates, templates_c, cahce and configs folders in my working directory.
I tried running the follwoing test:

The template file: resides in the template folder

Code: Select all

{* Smarty *}

Hello, {$name}!
The index.php file: resides in my working folder or application root

Code: Select all

<?
include('../../Smarty/Smarty.class.php');

// create object
$smarty = new Smarty;

//set the smarty dir
$smarty->template_dir = 'templates/';
$smarty->compile_dir = 'templates_c/';
$smarty->config_dir = 'configs/';
$smarty->cache_dir = 'cache/';

//assign content
$smarty->assign('name','Ned');

//display content
$smarty->display('templates/index.tpl');
?>
I am getting the following errors when i access the index.php file

Warning: _parse_resource_name(C:\htdocs\Smarty\internals\core.get_include_path.php): failed to open stream: No such file or directory in C:\htdocs\Smarty\Smarty.class.php on line 1643

Fatal error: _parse_resource_name(): Failed opening required 'C:\htdocs\Smarty\internals\core.get_include_path.php' (include_path='.;c:\php4\pear') in C:\htdocs\Smarty\Smarty.class.php on line 1643

Re: Samrty Templation Installtion and Configuration

Posted: Wed Sep 14, 2005 5:43 am
by jmut
See if you have your include paths correct...
And you don't need
$smarty->display('templates/index.tpl');
just
$smarty->display('index.tpl'); should be enough since you already defined where templates are....


Here is sample config...

Have project dir in htdocs somewhere

project/Smarty/ -> this is Smarty directory
project/templates/ -> this is where you place templates
project/templates_c/ -> this is where Smarty cache stuff -> should be writeable by your server running user


project/templates/index.html -> sample template and content following
{$test}

project/index.php -> the php that will run the templtate and its content

Code: Select all

<?php
error_reporting(E_ALL);
require_once('./Smarty/Smarty.class.php');

$smarty = new Smarty;
$smarty->debugging = true;
$smarty->assign('test','Hi there...If you see me it's working');
$smarty->display('index.html');
?>

Posted: Wed Sep 14, 2005 10:06 am
by lisamarie_tt
Thanks for your suggestions.

I tried your fixes and the same errors are occuring:
Warning: fetch(C:\htdocs\LisaMarie\vehicleParser\Smarty\internals\core.get_microtime.php): failed to open stream: No such file or directory in C:\htdocs\LisaMarie\vehicleParser\Smarty\Smarty.class.php on line 1142

Fatal error: fetch(): Failed opening required 'C:\htdocs\LisaMarie\vehicleParser\Smarty\internals\core.get_microtime.php' (include_path='.;c:\php4\pear') in C:\htdocs\LisaMarie\vehicleParser\Smarty\Smarty.class.php on line 1142


Do you have any other suggestions? Are there any other php configurations that should be made?

Posted: Wed Sep 14, 2005 11:10 am
by jmut
lisamarie_tt wrote:Thanks for your suggestions.

I tried your fixes and the same errors are occuring:
Warning: fetch(C:\htdocs\LisaMarie\vehicleParser\Smarty\internals\core.get_microtime.php): failed to open stream: No such file or directory in C:\htdocs\LisaMarie\vehicleParser\Smarty\Smarty.class.php on line 1142

Fatal error: fetch(): Failed opening required 'C:\htdocs\LisaMarie\vehicleParser\Smarty\internals\core.get_microtime.php' (include_path='.;c:\php4\pear') in C:\htdocs\LisaMarie\vehicleParser\Smarty\Smarty.class.php on line 1142


Do you have any other suggestions? Are there any other php configurations that should be made?
Well there is something wrong with the paths
do you have core.get_microtime.php file in this directory...
If not find the file...fix the path....enjoy

Posted: Fri Sep 16, 2005 8:47 am
by lisamarie_tt
No i don't. Thks for the info.