Louis11 Posted July 31, 2008 Share Posted July 31, 2008 I have been tinkering with SMARTY the last few days, and so far have had little problems. I am moderately familiar with the setup and have read through several articles found through Google as well as the documentation provided on the SMARTY website. With that said, I am having some problems with my SMARTY setup. I posted this question in the SMARTY forums (http://www.phpinsider.com/smarty-forum/viewtopic.php?p=51778#51778), but so far no one has been able to help The error in question is: Fatal error: Call to a member function assign() on a non-object in /Users/city.php on line 41 City.php contains: <? // include configuration files require_once('includes/configuration.php'); global $smarty; // get action $action = strip_tags($_GET['action']); // add new city if($action == 'add') { $smarty -> assign('sub_title', 'Add City'); $smarty -> display('pages/city_add.tpl'); } // modify existing city else if($action == 'modify') { $smarty -> assign('sub_title', 'Modify City'); $smarty -> display('pages/city_modify.tpl'); } // remove city else if($action == 'remove') { $smarty -> assign('sub_title', 'Remove City'); $smarty -> display('pages/city_remove.tpl'); } // show navigation else { $smarty -> assign('sub_title', 'City Management'); $smarty -> display('pages/city.tpl'); } ?> and the configuration file required: <? // include all library files require_once('libs/Smarty.class.php'); // setup SMARTY global $smarty; $smarty = new smarty; $smarty -> template_dir = 'templates'; $smarty -> compile_dir = 'templates_c'; $smarty -> cache_dir = 'cache'; $smarty -> config_dir = 'configs'; $smarty -> security = true; ?> I've tried several variations in setting up the smarty resource, but still no good. I added the global $smarty (as I was told to do in the SMARTY forums) and still nothing . . . I even verified that globals where turned on in my php.ini file. Any help would be greatly appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/117469-smarty-fatal-error/ Share on other sites More sharing options...
Chicken Little Posted September 29, 2008 Share Posted September 29, 2008 Have you tried cleaning out the cache and trying the page again? Quote Link to comment https://forums.phpfreaks.com/topic/117469-smarty-fatal-error/#findComment-653313 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.