Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
How to force compile on certain pages?

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


Joined: 15 Feb 2010
Posts: 20

PostPosted: Wed Mar 02, 2011 3:14 pm    Post subject: How to force compile on certain pages? Reply with quote

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


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

PostPosted: Wed Mar 02, 2011 3:19 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
nobody
Smarty Rookie


Joined: 15 Feb 2010
Posts: 20

PostPosted: Wed Mar 02, 2011 3:45 pm    Post subject: Reply with quote

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


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

PostPosted: Wed Mar 02, 2011 3:50 pm    Post subject: Reply with quote

with caching disabled completely does it work? what does the form template look like? the php code part?
Back to top
View user's profile Send private message Visit poster's website
nobody
Smarty Rookie


Joined: 15 Feb 2010
Posts: 20

PostPosted: Wed Mar 02, 2011 4:11 pm    Post subject: Reply with quote

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. Smile
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