|
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 |
redbrad0 Smarty Regular
Joined: 03 Feb 2007 Posts: 41
|
Posted: Sun Aug 03, 2014 8:17 pm Post subject: Using Multiple Web Server |
|
|
We are using smarty with 5 web servers where the cache is stored on each local web server. As smarty files are updated, we are having to update each web server so I was looking into setting smarty to use our existing Memcache servers but running into an issue.
Inside our plugins directory we have the file "cacheresource.memcache.php" but when we run the below script, it never calls it and throws the error "Class 'Smarty_CacheResource_Memcache' not found". Anyone have any ideas on what we should look at?
Code: |
require_once 'Smarty.class.php';
require_once 'SmartyPaginate.class.php';
require_once 'Smarty.Resource.CustomClass.class.php';
$smarty = new Smarty();
$smarty->setTemplateDir('/home/www/ourdomain.com/public_html_template/');
$smarty->setCompileDir('/home/www/ourdomain.com/public_html_template_compiler/');
$smarty->setCacheDir('/home/www/ourdomain.com/public_html_template_cache/');
$smarty->registerResource('db', new Smarty_Resource_CustomClass());
$smarty->registerCacheResource('memcache', new Smarty_CacheResource_Memcache());
|
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Aug 03, 2014 9:51 pm Post subject: |
|
|
If "cacheresource.memcache.php" is located in the plugins directory don't register the cache resource (the file does not get autoloaded)
Just set
Code: | $smarty->caching_type = 'memcache'; |
This will load the resource from the plugins folders.
See http://www.smarty.net/docs/en/caching.custom.tpl |
|
Back to top |
|
redbrad0 Smarty Regular
Joined: 03 Feb 2007 Posts: 41
|
Posted: Mon Aug 04, 2014 2:28 pm Post subject: |
|
|
I tried that before, but just did it again and it is not loading from the plugin directory. It is in the folder "plugin" not the "sysplugins" directory. I know that it is not calling the file as I have some code in each function to output to the browser that the script is running. Any other ideas?
Quote: |
require_once 'Smarty.class.php';
require_once 'SmartyPaginate.class.php';
require_once 'Smarty.Resource.CustomClass.class.php';
$smarty = new Smarty();
$smarty->setTemplateDir('/home/www/ourdomain.com/public_html_template/');
$smarty->setCompileDir('/home/www/ourdomain.com/public_html_template_compiler/');
$smarty->setCacheDir('/home/www/ourdomain.com/public_html_template_cache/');
$smarty->caching_type = 'memcache';
$smarty->registerResource('db', new Smarty_Resource_CustomClass()); |
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Aug 04, 2014 6:03 pm Post subject: |
|
|
I checked it once again. It's loaded from the plugins folder, but ofcause only if you have enabled caching with
$smarty->caching = true; |
|
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
|