Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Using Multiple Web Server

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
redbrad0
Smarty Regular


Joined: 03 Feb 2007
Posts: 40

PostPosted: Sun Aug 03, 2014 8:17 pm    Post subject: Using Multiple Web Server Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Sun Aug 03, 2014 9:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
redbrad0
Smarty Regular


Joined: 03 Feb 2007
Posts: 40

PostPosted: Mon Aug 04, 2014 2:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Mon Aug 04, 2014 6:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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