Thread: [htmltmpl] Small questions.
Brought to you by:
samtregar
From: Matias A. G. <ma...@ni...> - 2006-05-17 12:21:46
|
Hi all! I've been using Template::HTML for 3 months, I would like to ask you a few questions 1) In our project we are using around 50 different templates, It is very common for us to do something like: <tmpl_loop departments> <tmpl_if show_picture> <tmpl_if picture_url> <tmpl_include user_picture.tmpl> </tmpl_if> </tmpl_if> <tmpl_if users> <tmpl_loop> <tmpl_include show_user.tmpl> </tmpl_loop> </tmpl_if> </tmpl_loop> So, some of our pages include 200 templates (we use shared_cached=3D>1). Th= ese 'include' strategy helps our designer because its HTML code is reutilized over and over. Would you say this is a correct approach? What about performace? I know be need to benchmark, but it there any commets you can make? Thanks! 2) Wouldn't be nice to have a template comment tag? I think it would be useful to describe template, and not generate HTML. Fo= r example: <!-- <tmpl_comment> This template shows a user. bla bla Inputs: - bla bla </tmpl_comment> --> or <!-- # This template shows a user. bla bla # Inputs: # - bla bla --> In our project we 'compile' the templates before installing to production, so normal HTML comments are taken away, but I think that the 'comment' tag would be interesting to have. Thanks! mat=EDas --=20 Mat=EDas Alejo Garc=EDa NITS Argentina | http://www.nits.com.ar |
From: Roger B. W. <ro...@fi...> - 2006-05-17 12:35:46
|
On Wed, May 17, 2006 at 09:21:35AM -0300, Matias Alejo Garcia wrote: >2) Wouldn't be nice to have a template comment tag? You can get the same effect with: <tmpl_if name=i_am_never_going_to_set_this_variable> comments here </tmpl_if> Roger |
From: Sam T. <sa...@tr...> - 2006-05-17 14:52:33
|
On Wed, 17 May 2006, Matias Alejo Garcia wrote: > So, some of our pages include 200 templates (we use shared_cached=>1). These > 'include' strategy helps our designer because its HTML code is reutilized > over and over. > Would you say this is a correct approach? What about performace? I know be > need to benchmark, but it there any commets you can make? Thanks! Are you using caching? Are you pre-caching your templates during server startup? If so then you can have as many includes as you want and it won't make a bit of difference at runtime. -sam |
From: Matias A. G. <ma...@ni...> - 2006-05-17 14:57:32
|
On 5/17/06, Sam Tregar <sa...@tr...> wrote: > > On Wed, 17 May 2006, Matias Alejo Garcia wrote: > > > So, some of our pages include 200 templates (we use shared_cached=3D>1)= . > These > > 'include' strategy helps our designer because its HTML code is > reutilized > > over and over. > > Would you say this is a correct approach? What about performace? I know > be > > need to benchmark, but it there any commets you can make? Thanks! > > Are you using caching? Are you pre-caching your templates during > server startup? If so then you can have as many includes as you want > and it won't make a bit of difference at runtime. Yes, we are using shared_cached. We are no precaching, but we will once we reach our beta version. Thanks! Great news! mat=EDas -sam > --=20 Mat=EDas Alejo Garc=EDa NITS Argentina | http://www.nits.com.ar |
From: Sam T. <sa...@tr...> - 2006-05-17 15:00:00
|
On Wed, 17 May 2006, Matias Alejo Garcia wrote: >> Are you using caching? Are you pre-caching your templates during >> server startup? If so then you can have as many includes as you want >> and it won't make a bit of difference at runtime. > > Yes, we are using shared_cached. We are no precaching, but we will once we > reach our beta version. Yeesh - shared_cache is terrible. I really should remove it. It's no faster than file_cache and much more prone to problems. Both are much slower than regular cache mode. -sam |
From: Mathew R. <mat...@ne...> - 2006-05-17 23:22:09
|
Shared cache has the nice effect of reducing the memory footprint of the templates, when running apache in multi-process mode. Mathew > Yeesh - shared_cache is terrible. I really should remove it. It's > no faster than file_cache and much more prone to problems. Both are > much slower than regular cache mode. > > -sam > |
From: Mathew R. <mat...@ne...> - 2006-05-17 23:24:04
|
You can use a filter to strip stuff from your templates - check the list archive for examples Mathew > 2) Wouldn't be nice to have a template comment tag? > I think it would be useful to describe template, and not generate > HTML. For example: > <!-- <tmpl_comment> > This template shows a user. bla bla > Inputs: > - bla bla > </tmpl_comment> > --> > or > > <!-- > # This template shows a user. bla bla > # Inputs: > # - bla bla > --> > > In our project we 'compile' the templates before installing to > production, so normal HTML comments are taken away, but I think that > the 'comment' tag would be interesting to have. > |
From: Sam T. <sa...@tr...> - 2006-05-18 04:11:08
|
On Thu, 18 May 2006, Mathew Robertson wrote: > Shared cache has the nice effect of reducing the memory footprint of the > templates, when running apache in multi-process mode. So does file_cache, and it's a heck of a lot easier to manage! -sam |
From: Matias A. G. <ma...@ni...> - 2006-05-18 12:52:14
|
On 5/18/06, Sam Tregar <sa...@tr...> wrote: > > On Thu, 18 May 2006, Mathew Robertson wrote: > > > Shared cache has the nice effect of reducing the memory footprint of th= e > > templates, when running apache in multi-process mode. > > So does file_cache, and it's a heck of a lot easier to manage! Maybe a good option would be to use 'memcached' (Cache::Memcached, which ca= n also be shared in the distributed environment, and is very easy to manage) instead of IPC. What you think? -sam > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > --=20 Mat=EDas Alejo Garc=EDa NITS Argentina | http://www.nits.com.ar UADE | Profesor Adjunto | Departamento de Inform=E1tica |
From: Sam T. <sa...@tr...> - 2006-05-18 19:13:23
|
On Thu, 18 May 2006, Matias Alejo Garcia wrote: > Maybe a good option would be to use 'memcached' (Cache::Memcached, which can > also be shared in the distributed environment, and is very easy to manage) > instead of IPC. What you think? Seems like a fun project, if possibly self-defeating. I think it's unlikely that it would be faster than file_cache on a system with enough free memory to cache file-system access, but of course I could be wrong. Stuff like this would be much easier to experiment with if I actually put out HTML::Template v3. I'd like to split off the caching stuff into a separate plugable system. Right now the cache-handling is in the core module and not terribly easy to extend. -sam |
From: Matias A. G. <ma...@ni...> - 2006-05-19 19:38:11
|
On 5/18/06, Sam Tregar <sa...@tr...> wrote: > > On Thu, 18 May 2006, Matias Alejo Garcia wrote: > > > Maybe a good option would be to use 'memcached' (Cache::Memcached, whic= h > can > > also be shared in the distributed environment, and is very easy to > manage) > > instead of IPC. What you think? > > Seems like a fun project, if possibly self-defeating. I think it's > unlikely that it would be faster than file_cache on a system with > enough free memory to cache file-system access, but of course I could > be wrong. Thanks for your answer. We are setting an apache cluster in the next few months, so maybe we will evaluate that. Stuff like this would be much easier to experiment with if I actually > put out HTML::Template v3. I'd like to split off the caching stuff > into a separate plugable system. Right now the cache-handling is in > the core module and not terribly easy to extend. That sounds great! --=20 Mat=EDas Alejo Garc=EDa NITS Argentina | http://www.nits.com.ar |