|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
shagwell Smarty Rookie
Joined: 29 Oct 2003 Posts: 6
|
Posted: Wed Oct 29, 2003 6:21 pm Post subject: Lets make Smarty work ! |
|
|
Lets make Smarty work !
Hi Smarty users, and others.....
I started in school and there said i need to make my homepage via the Smarty Template Engine.
Im just having probloms getting it to work, i installed it on my FreeBSD server from the ports tree, and added this line in php.ini:
include_path = ".:/usr/local/share/smarty"
Then i wanted to make a test run, so I made some directory's according to the manual:
It now looks like this at my doc root where "/" is a directory:
/cache
/configs
/templates
/templates
index.php
I followed some examples, but its not working at all please help me out getting it to work.
Best Regards
Martin
Copenhagen
Denmark
Last edited by shagwell on Wed Oct 29, 2003 7:35 pm; edited 1 time in total |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Oct 29, 2003 6:30 pm Post subject: |
|
|
turn on error_reporting and display_errrors on in your php (if you haven't already). and post the first errors you get here. then we may be able to help you.
greetings
messju |
|
Back to top |
|
shagwell Smarty Rookie
Joined: 29 Oct 2003 Posts: 6
|
Posted: Wed Oct 29, 2003 7:23 pm Post subject: |
|
|
I write my errors out in a file only, but here it is:
[29-Oct-2003 20:27:13] PHP Fatal error: main(): Failed opening required 'Smartty.class.php' (include_path='.:/usr/local/share/smarty') in /usr/home/myuser/www/mydomain/beta/index.php on line 2
The file 'Smartty.class.php' is located in /usr/local/share/smarty.
My index.php looks like this:
<?php
require 'Smartty.class.php';
$smarty = new Smarty;
?>
But lets take it from here, iam glad for the help so far,
Thanks |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Oct 29, 2003 8:07 pm Post subject: |
|
|
"Smartty.class.php" or "Smarty.class.php" ?
also check if you include path is really the one from php.ini (with <?php phpinfo(); ?>)
remember to restart your webserver after changing the php.ini |
|
Back to top |
|
shagwell Smarty Rookie
Joined: 29 Oct 2003 Posts: 6
|
Posted: Wed Oct 29, 2003 8:21 pm Post subject: |
|
|
it was: Smarty.class.php not Smartty.class.php my fault, sorry.
Iam down to the filerights is wrong:
all files in my /usr/local/share/smarty have it like this:
-r--r--r-- 1 root wheel 9962 Oct 29 14:54 Config_File.class.php
-r--r--r-- 1 root wheel 87861 Oct 29 20:43 Smarty.class.php
-r--r--r-- 1 root wheel 65286 Oct 29 14:54 Smarty_Compiler.class.php
-r--r--r-- 1 root wheel 4977 Oct 29 14:54 debug.tpl
drwxr-xr-x 2 root wheel 1536 Oct 29 14:54 plugins
my php.ini has it like this:
include_path /usr/local/share/smarty/ /usr/local/share/smarty/
Its telling mee this now:
Warning: main(): SAFE MODE Restriction in effect. The script whose uid is 1001 is not allowed to access /usr/local/share/smarty/Smarty.class.php owned by uid 0 in /usr/home/www/docs/beta/index.php on line 2
i turned off error logging to a file, and got this error with more info, it must be the file rights.
Last edited by shagwell on Wed Oct 29, 2003 9:11 pm; edited 1 time in total |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Oct 29, 2003 9:00 pm Post subject: |
|
|
if you are using safe_mode, then you have to set
safe_mode_include_dir = "/usr/local/share/smarty/"
in your php.ini. this allows the files there to be accessed by the script
and you have to set $smarty->use_sub_dirs to false in your index.php to let smarty work in safe_mode.
i suggest you read http://de.php.net/features.safe-mode
(also safe_mode_include_dir and other permission-stuff is explained there). if you don't need all the stuff explained there then it's easiest to set safe_mode=Off in your php.ini . maybe you can re-enable safe-mode if you have enough experience and got smarty working in (un-)safe-mode.
BTW: it's not good to put a phpinfo()-page public. it's not a security issue per se, but bad bored people can get info about your webserver and you operating etc. by it, and can use this info at a starting point to break in your system. |
|
Back to top |
|
shagwell Smarty Rookie
Joined: 29 Oct 2003 Posts: 6
|
Posted: Wed Oct 29, 2003 9:18 pm Post subject: |
|
|
Okay, ill test it in unsafe mode.
The errors is ther no more, with safe_mode off.
All i can hope for now, is some code so i can test that is works 100% so i can start making some fun with the Smarty system.
Thanks Again for good help. |
|
Back to top |
|
shagwell Smarty Rookie
Joined: 29 Oct 2003 Posts: 6
|
Posted: Wed Oct 29, 2003 10:02 pm Post subject: |
|
|
I tryid to use, the Demo from source, and its gettning mee is it realy so hard getting this Smarty to Work
Warning: Smarty error: unable to read template resource: "index.tpl" in /usr/local/share/smarty/Smarty.class.php on line 1042
Warning: _generate_debug_output(templates_c/%%-39/%%-391790113/debug.tpl.php): failed to open stream: No such file or directory in /usr/local/share/smarty/Smarty.class.php on line 1258
Warning: _generate_debug_output(): Failed opening 'templates_c/%%-39/%%-391790113/debug.tpl.php' for inclusion (include_path='/usr/local/share/smarty/') in /usr/local/share/smarty/Smarty.class.php on line 1258
My index.php locks like this:
<?php
require 'Smarty.class.php';
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = true;
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
$smarty->assign("FirstName",array("John","Mary","James","Henry"));
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
array("I", "J", "K", "L"), array("M", "N", "O", "P")));
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
$smarty->assign("option_selected", "NE");
$smarty->display('index.tpl');
?> |
|
Back to top |
|
shagwell Smarty Rookie
Joined: 29 Oct 2003 Posts: 6
|
Posted: Thu Oct 30, 2003 11:16 am Post subject: |
|
|
I got it to work
Tnx |
|
Back to top |
|
mlaco Smarty n00b
Joined: 11 May 2003 Posts: 4
|
Posted: Thu Aug 19, 2004 6:56 pm Post subject: One Smarty, Many aplications + Safe mode ??? |
|
|
Hi,
I want to use one centralized smarty instalation (base system + plugins + modifikators...) for several php aplications on the same server. SAFE_MODE is on. Smarty and plugins directory are under safe_mode_include_dir (which allows including, *but not reading*).
But smarty uses is_readable() method for loading plugins, which returns false (since file owners do not match in safe mode), which is bad.
Is there some solution?
mlaco,
Slovakia. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Aug 19, 2004 8:44 pm Post subject: |
|
|
this looks like a bug in php to me.
http://php.net/is_readable explicitely states: "Safe mode limitations are not taken into account." |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|