|
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 |
UrBob Smarty n00b
Joined: 01 Feb 2017 Posts: 3 Location: UK
|
Posted: Wed Feb 01, 2017 11:57 am Post subject: SVN and Smarty - project setup |
|
|
Hope this is the right section to post.
I have a project which is based on Smarty and has been added to SVN. I recently re-deployed the project and noticed that there are a number of folders that seem to be caches.
If I understand how Smarty works correctly, when using a template it is checked to see if it has been changed and if so the cache copy is updated with the 'compiled' version, which is then used to display the actual page.
Since the new cached version is on the server that the template has been deployed to, it never gets updated in SVN, which has the original content of the folder. This would mean that there are a whole heap of files/folders that I don't need to store in SVN in the first place since they are re-created as needed.
Please correct me if I'm wrong, or advise what I can add to the SVN ignore list.
I am not at all expert at Smarty yet, one of our developers introduced it as the way to go for a project, and I'm having to catch up while managing everything. (I think his choice of Smarty is right, by the way). |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Feb 01, 2017 12:55 pm Post subject: |
|
|
Setup compile directory and cache directory both inside a deployment temporary files directory, so that they are never stored in VCS.
Something like this:
Code: | $tpl = new Wrappers\Smarty();
$tpl->setCompileCheck(defined('TS_COMPILE_CHECK') ? TS_COMPILE_CHECK : Smarty::COMPILECHECK_CACHEMISS);
$tpl->setCaching(defined('TS_CACHING') ? TS_CACHING : Smarty::CACHING_LIFETIME_SAVED);
$tpl->cache_lifetime = defined('TS_CACHE_LIFETIME') ? TS_CACHE_LIFETIME : 21600;
$tpl->setConfigDir("$smartyBaseDir/configs");
$tpl->addPluginsDir("$smartyBaseDir/plugins");
$tpl->setTemplateDir("$smartyBaseDir/templates");
$tpl->setCacheDir("$smartyTempDir/cache");
$tpl->setCompileDir("$smartyTempDir/templates_c");
$tpl->configLoad('admin.cfg'); |
Also learn about Composer. |
|
Back to top |
|
UrBob Smarty n00b
Joined: 01 Feb 2017 Posts: 3 Location: UK
|
Posted: Thu Feb 02, 2017 11:47 am Post subject: |
|
|
Thanks for the quick response.
The code makes sense, but don't yet know where I would put it. Any clues appreciated.
(As I said in the original post, someone else set it all up and I'm playing catch-up). |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Feb 02, 2017 12:55 pm Post subject: |
|
|
You put it where it makes sense.
This is YOUR code, after all.
I'm typically make it all in one place, near initialization. |
|
Back to top |
|
UrBob Smarty n00b
Joined: 01 Feb 2017 Posts: 3 Location: UK
|
Posted: Thu Feb 02, 2017 9:23 pm Post subject: |
|
|
Thanks.
I'll have to look carefully, but I'm fairly certain I know where that should go now.
I was thinking there was some particular place in the Smarty code to put configuration information. Looks like I have a job for the weekend when no-one else is working |
|
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
|