Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Fatal error: Call to a member function SetTemplateDir() on

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
rearcher
Smarty n00b


Joined: 04 Oct 2011
Posts: 2
Location: Basking Ridge, NJ USA

PostPosted: Tue Oct 04, 2011 5:50 pm    Post subject: Fatal error: Call to a member function SetTemplateDir() on Reply with quote

I'm a rookie smarty user. I'm now attempting to install smarty for the first time. I can't seem to do a SetTemplateDir. Any advice would be appreciated. Thanks in advance.

Here is my test.php code

<?php

// Put full path to $smarty.class.php
require_once('/home/bjumc67/php/Smarty/Smarty.class.php');
$smarty = new Smarty();

//$smarty->debugging = true;
//$smarty->caching = true;
//$smarty->cache_lifetime = 120;

$smarty->testInstall();

$Smarty->SetTemplateDir('/www/rearcher.com/app1/templates/');
$Smarty->SetCompileDir('/www/rearcher.com/app1/templates_c/');
$Smarty->SetCacheDir('/www/rearcher.com/app1/cache/');
$Smarty->SetConfigDir('/www/rearcher.com/zpp1/config/');

//$smarty->testInstall();

$Smarty->assign('name','Russ');
$smarty->display('test.tpl');

?>

Here is what I get:

Smarty Installation test...
Testing template directory...
./templates/ is OK.
Testing compile directory...
./templates_c/ is OK.
Testing plugins directory...
Testing cache directory...
./cache/ is OK.
Testing configs directory...
./configs/ is OK.
Testing sysplugin files...
... OK
Testing plugin files...
... OK
Tests complete.


Fatal error: Call to a member function SetTemplateDir() on a non-object in /home/bjumc67/public_html/rearcher.com/test.php on line 13
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Oct 05, 2011 3:59 pm    Post subject: Reply with quote

Observe your cases

$smarty != $Smarty

and the camelcase methods name are like setTemplateDir
Back to top
View user's profile Send private message
rearcher
Smarty n00b


Joined: 04 Oct 2011
Posts: 2
Location: Basking Ridge, NJ USA

PostPosted: Thu Oct 06, 2011 12:38 am    Post subject: Reply with quote

Thanks correct spelling made a world of difference. Very Happy

I'm off to my next challenge. I have not figured out the chown to "nobody" requirement on my web server. It doesn't look like I have enough privileges to make that change.

Everything works if configs, ... are directly under /www/rearcher.com and I don't execute the "sets" ---but if I add a directory, say "app" (so the configs directory would be /www/rearcher.com/app") and put configs ... there I can't do the sets.

All the ownerships and privileges are identical for /www/rearcher.com/configs and /www/rearcher.com/app/configs

Sigh!
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Oct 06, 2011 1:47 pm    Post subject: Reply with quote

changing file ownership requires root privileges. however, you should be able to change the permissions on the file to something the web server can read such as 644 for files or 755 for folders. If the web server needs write access, then use 666 for files and 777 for folders.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP