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

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
winus
Smarty Rookie


Joined: 22 Dec 2008
Posts: 7

PostPosted: Thu Oct 11, 2012 2:51 pm    Post subject: Override compile_check options Reply with quote

I have a site driven by smarty, and i let the code the admin's enter a few plugin-codes to make there life easier. So i built a custom resource and all works well. But i have the option compile_check = false...

When they change a line of code in a article the article is never fetched from the database anymore... it stays compiles..

(how) can i force a custom resource to use compile_check = true ?
Back to top
View user's profile Send private message
kataxxx
Smarty Rookie


Joined: 08 Apr 2012
Posts: 10

PostPosted: Thu Oct 11, 2012 5:56 pm    Post subject: Re: Override compile_check options Reply with quote

From what I know using smarty,
You edit/create the templates, compile all the templates (Smarty->compile_all something), and then disable compile_check.
Maybe you wanna try that one.
Good luck!
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Fri Oct 12, 2012 12:02 am    Post subject: Reply with quote

Your database must contain timestamps for this.

See in the /demo/plugins folder resource.mysql.php as an example.
Back to top
View user's profile Send private message
winus
Smarty Rookie


Joined: 22 Dec 2008
Posts: 7

PostPosted: Fri Oct 12, 2012 10:48 am    Post subject: Reply with quote

I think i let some information behind.

The resource does have timestamp by the way.

Maybe i am using smarty for what it is not designed for Wink

it's a news site where administrators can add news to.
The news is parsed as a unique template (each item is a unique template).
This gives the option to parse some block functions i use for generating url's
{url id=123}news_detail{url} etc.

Therefor each post, is a template... The full generated page is cached anyway.
Back to top
View user's profile Send private message
winus
Smarty Rookie


Joined: 22 Dec 2008
Posts: 7

PostPosted: Mon Oct 29, 2012 8:25 am    Post subject: Reply with quote

Anyone ? If it is not possible it might be a nice feature?
Back to top
View user's profile Send private message
kataxxx
Smarty Rookie


Joined: 08 Apr 2012
Posts: 10

PostPosted: Wed Oct 31, 2012 2:59 pm    Post subject: Reply with quote

[quote]Maybe i am using smarty for what it is not designed for [/quote]
I couldn't really understand what you are trying to acchive, but try other solution. One that works with Smarty. You are programmer, you can do it. :)
Try using http://www.smarty.net/docs/en/api.clear.compiled.tpl.tpl (template, template_id). Execute it after the line of code is changed.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed Oct 31, 2012 6:54 pm    Post subject: Reply with quote

compile_check is a global Smarty flag. Because of the internal logic there is no way that a resource can change it's value just during compiling a single template.

So the clearCompiledTpl() function could be your friend.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development 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