Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: [SMARTY] compile all templates at once
On Sat, Aug 14, 2004 at 10:24:44AM +0300, Maris wrote:
> Hi,
>
> 1) is there a way to tell Smarty to compile all templates
> from smarty/templates to smarty/compile without clicking
> through all www pages and waiting till all templates have
> been visited and compiled?

write a script that searches through $smarty->template_dir and call
$smarty->fetch() for each template found.

> 2) Since templates are compiled they can be encoded with
> Zend and posted to clients server. Is there any Smarty setting that
> should be reset to zero to avoid template recompilation after some
> X days? In other words - how to make sure that templates
> are not being tried to recompile after some period of time?

$smarty->compile_check = false;

> Thanks,
> Maris

wbr
messju

Report this thread to moderator Post Follow-up to this message
Old Post
Messju Mohr
08-14-04 01:56 PM


Re: [SMARTY] compile all templates at once
Thanks a lot, it works :)


"Messju Mohr" <messju@lammfellpuschen.de> wrote in message
news:20040814085637.GE9698@pharao.serveftp.org...
> On Sat, Aug 14, 2004 at 10:24:44AM +0300, Maris wrote: 
>
> write a script that searches through $smarty->template_dir and call
> $smarty->fetch() for each template found.
> 
>
> $smarty->compile_check = false;
> 
>
> wbr
> messju

Report this thread to moderator Post Follow-up to this message
Old Post
Maris
08-15-04 08:57 AM


Re: [SMARTY] compile all templates at once
On 8/14/04 4:56 AM, "messju mohr" <messju@lammfellpuschen.de> wrote:

> On Sat, Aug 14, 2004 at 10:24:44AM +0300, Maris wrote: 
>
> write a script that searches through $smarty->template_dir and call
> $smarty->fetch() for each template found.

This will work just fine for templates that are not influenced by GET or
POST requests.  But, for GET/POST "pre-caching/pre-compiling" you should
look at a tool like curl or better, wget.

I usually just kick off a wget crawl using a user:pass combo and the
client's site gets compiled and cached.

check out the wiki for more info:

http://smarty.incutio.com/?page=CacheAndCompile

cheers,
dan
 
>
> $smarty->compile_check = false;
> 
>
> wbr
> messju

Report this thread to moderator Post Follow-up to this message
Old Post
Daniel Cummings
08-16-04 08:59 PM


Re: [SMARTY] compile all templates at once
> This will work just fine for templates that are not influenced by GET or
> POST requests.  But, for GET/POST "pre-caching/pre-compiling" you should
> look at a tool like curl or better, wget.

Most smarty templates shouldnt be affected by GET/POST requests at
compile time, as that only affects what comes out of the templates at
runtime. If you're only looking to compile the templates into PHP
code, theres nothing wrong with calling fetch() in a loop. Its only if
you're caching that you need to think about output.

-bok

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Amos
08-17-04 01:57 PM


Re: [SMARTY] compile all templates at once
On Tue, Aug 17, 2004 at 09:12:32PM +1000, Robert Amos wrote: 
>
> Most smarty templates shouldnt be affected by GET/POST requests at
> compile time, as that only affects what comes out of the templates at
> runtime. If you're only looking to compile the templates into PHP
> code, theres nothing wrong with calling fetch() in a loop. Its only if
> you're caching that you need to think about output.

yes. i forgot to mention you should set $smarty->caching=false in your
recompile-all-templates-script regardless if you use caching on the
real site or not.

> -bok
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Report this thread to moderator Post Follow-up to this message
Old Post
Messju Mohr
08-17-04 01:57 PM


Re: [SMARTY] compile all templates at once
On 8/17/04 7:23 AM, "messju mohr" <messju@lammfellpuschen.de> wrote:

> On Tue, Aug 17, 2004 at 09:12:32PM +1000, Robert Amos wrote: 
>
> yes. i forgot to mention you should set $smarty->caching=false in your
> recompile-all-templates-script regardless if you use caching on the
> real site or not.

Thanks for the clarifications, guys...

However, if you use multiple compile_ids (e.g., one per client based on
login info) it *would* have an impact, right?. That's the way I work with
compiled scripts because I need to be able to update/clear one client's code
base without affecting the others.

Am I correct in this approach? Or am I making work for myself?

dan
 

Report this thread to moderator Post Follow-up to this message
Old Post
Daniel Cummings
08-17-04 08:59 PM


Re: [SMARTY] compile all templates at once
On Tue, 17 Aug 2004 10:41:21 -0400, Daniel Cummings <dan@dbmscan.com> wrote:
> On 8/17/04 7:23 AM, "messju mohr" <messju@lammfellpuschen.de> wrote:
> 
>
> Thanks for the clarifications, guys...
>
> However, if you use multiple compile_ids (e.g., one per client based on
> login info) it *would* have an impact, right?. That's the way I work with
> compiled scripts because I need to be able to update/clear one client's co
de
> base without affecting the others.
>
> Am I correct in this approach? Or am I making work for myself?
>

That really depends on the nature of your scripts. If the compiled php
source itself will change according to the user details, then its
fine, however if the source stays the same and the input/output mearly
changes based on assigned information (as happens 99% of the time)
then having multiple compiled copies would just waste disk space +
time and you could probably just set a cache_id.

The rule doesn't hold true always though, so unless you've got a
thousand templates wasting disk space, you're better off sticking with
what works :)

-bok

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Amos
08-17-04 08:59 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Smarty Templates archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:34 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.