 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
nobody Smarty Rookie
Joined: 15 Feb 2010 Posts: 20
|
Posted: Wed Mar 02, 2011 3:14 pm Post subject: How to force compile on certain pages? |
|
|
I have set $force_compile in Smarty.class.php to false because this speeds up my site significantly.
However, now my contact form won't work. Most of the time, it show the success message ("Thanks, we've received your message"). When I set $force_compile to true, it works fine.
Is there a way to force compile on certain pages? |
|
| Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7042 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 02, 2011 3:19 pm Post subject: |
|
|
| You should never have $force_compile true in production, this for debugging purposes only. Be sure you have $compile_check set to true if you are editing template files. Is that the case? |
|
| Back to top |
|
nobody Smarty Rookie
Joined: 15 Feb 2010 Posts: 20
|
Posted: Wed Mar 02, 2011 3:45 pm Post subject: |
|
|
Thanks for the quick reply.
Okay, this was a mistake I just recently noticed. $compile_check is set to true, but this doesn't seem to affect the contact form problem.
Caching is activatet in Smarty.class.php, but I have deactivated caching in the submit.php file (which I use for the contact form).
Any ideas? |
|
| Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7042 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 02, 2011 3:50 pm Post subject: |
|
|
| with caching disabled completely does it work? what does the form template look like? the php code part? |
|
| Back to top |
|
nobody Smarty Rookie
Joined: 15 Feb 2010 Posts: 20
|
Posted: Wed Mar 02, 2011 4:11 pm Post subject: |
|
|
Aha! I was just about to post the submit.php file when I figured out that I hadn't disabled caching completely after all.
I had this line of code in the start of the document:
if (!$tpl->is_cached(DEF_TEMPLATE . '/index.tpl')) {
All I checked the first time was that this was set to "0":
$tpl->caching = 0;
Thanks for the help! I'm always learning something when using Smarty.  |
|
| 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
|