Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
How to force compiling after template change

 
Post new topic   Reply to topic    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
moiseyo
Smarty n00b


Joined: 03 Sep 2009
Posts: 1

PostPosted: Thu Sep 03, 2009 5:33 pm    Post subject: How to force compiling after template change Reply with quote

m looking into Smarty , and ran into problem that after template , compiles in need to delete it in cach before I can see changes in i made in template .

Do you know how to force compile every time i made cages in template.

I looked into doc , bot did not see , looks like a smile question.

am using:
$smarty->display('property/p_list.tpl',false);

is there better way ?


Moisey O | Do not keep all eggs in the same basket
| Microsalt
Go to Previous message |
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Thu Sep 03, 2009 6:56 pm    Post subject: Reply with quote

Smarty should recompile templates if they are changed. Be sure that:

Code:
$smarty->compile_check = true;


which is the default setting.

Also be sure that caching is disabled if you don't want to see the cache every time. If you want cache and compile recreated every time, set:

Code:
$smarty->force_compile = true;


Be sure to disable that before going to production.
Back to top
View user's profile Send private message Visit poster's website
conlonm
Smarty n00b


Joined: 22 Oct 2009
Posts: 1

PostPosted: Thu Oct 22, 2009 7:55 pm    Post subject: Reply with quote

I have had a similar problem with updated templates not being displayed. For instance, if I update the footer.tpl file on my site - changing the date to 2009 - the footer isn't displayed once uploaded. I can only resolve the problem by uploading the old file with the old date stamp.

Code:
$smarty->compile_check = true;


is set to 'true' already. I tried

Code:
$smarty->force_compile = true;


but that made no difference. The updated template wasn't displayed. The site is working but I can't update certain sections of it which is a bit limiting. Can you suggest anything else I could try?
Back to top
View user's profile Send private message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 420
Location: Kathmandu, Nepal

PostPosted: Sat Oct 24, 2009 1:14 pm    Post subject: Compile everytime :-) Reply with quote

Unless you are in a production stage, you should consider compiling templates everytime, to avoid these problems.

If you execute the below codes, it guarantees that all complied files are removed, and Smarty will force itself to recomplie (because there will be nothing to cache).
Code:
# Cleanup Smarty's compiled pages.
$smarty->clear_compiled_tpl();


When you complete your project and move to the production, you can remove this line of code, and enable caching.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
webcoder26
Smarty n00b


Joined: 11 Jul 2013
Posts: 1

PostPosted: Thu Jul 11, 2013 7:11 am    Post subject: Re: Compile everytime :-) Reply with quote

bimal wrote:
Unless you are in a production stage, you should consider compiling templates everytime, to avoid these problems.

If you execute the below codes, it guarantees that all complied files are removed, and Smarty will force itself to recomplie (because there will be nothing to cache).
Code:
# Cleanup Smarty's compiled pages.
$smarty->clear_compiled_tpl();


When you complete your project and move to the production, you can remove this line of code, and enable caching.


Where should I add this code please?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu Jul 11, 2013 7:16 pm    Post subject: Reply with quote

Normally
Code:
$smarty->compile_check = true;

which is also the default setting should do the job that updated template get automatically recompiled.

This may fail when you are uploading template files to a server and the system clocks are out of sync.

As mentioned before for such cases
Code:
$smarty->force_compile = true;

could be usefull during development.

Calling
Code:
$smarty->clearCompiledTemplate();

does not make too much sense
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Installation and Setup 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