PDA

View Full Version : Smarty and Relative Paths


Tyler
April 18th, 2006, 22:07
I'm new to Smarty, so excuse me if I'm being dumb. Doing an absolute path can really be bad, as many people do not know how to find out and are too lazy. So if this can be done in relative path, that'd be great.

This file (index.php) is in:
C:\Program Files\Apache Group\Apache2\htdocs\photo\admin

The template is in:
C:\Program Files\Apache Group\Apache2\htdocs\photo\templates

So I was doing:


//Caching dir.
$tpl->cache_dir = '../templates_c';

//Displays the register page.
$tpl->display('../admin/index.tpl');

Which displays:

Warning: Smarty error: unable to read resource: "../admin/index.tpl" in C:\Program Files\Apache Group\Apache2\htdocs\photo\includes\smarty\Smarty. class.php on line 1095

So anyone have any idea on how I can solve this without using absolute paths?

Tyler
April 19th, 2006, 00:05
Got it! I had to set it :)

sea otter
April 21st, 2006, 15:55
Don't you just love it when you answer your own questions? :cool: