Questions about good tpl design for Static Caching

Author Message

Massimiliano Bariola

Wednesday 22 February 2006 5:36:39 am

Hi,

I am looking forward to activate static caching on a high-traffic website, and had some questions for those who are experienced in its use so to avoid problems later.

All of this revolves around the use of navigator/google.tpl which caused me some cache-related problems when I used it on earlier projects. maybe these can be avoided with a cleverer design springing up from your suggestions :-)

I have some override templates for specific folders which list their content as a formatted list. for big amounts of items, this list is paged - so google.tpl serves just this purpose.

the google.tpl include is placed at the end of the "full" override template for the folder.

let's suppose I have 2 of these list folders accessible at /foo/list1 and /foo/list2.

When I have viewcaching, contentcaching, templatecompile and templatecaching on, and I access /foo/list1, google.tpl generates links like /foo/list1/(offset)/10, /foo/list1/(offset)/20, etc. so far, so good!

however, when I access /foo/list2, google.tpl will generate links like /foo/list1/(offset)/10 and so on. thus using the first accessed node , list1 , as a base. eek!.

I don't know whether this is connected to ViewCaching or to TemplateCompile or TemplateCaching, but let's say I worked around this, by using cache-blocks and leaving the google.tpl out of them.

So, now I have a site which is working with "regular" caching, at the expense of the need to use some tricks (disable cache, enable cache for all tpl save the google.tpl and so )

Now I want to use static cache. by definition, static cache generator renders all the full templates of all content nodes. Enter those folders with big amounts of items and let's assume that the HTML content is correctly generated for all nodes.

The problem here is, there are some classes which do not have a full.tpl of their own - but they are meant to be displayed into other templates. my case is an image gallery with some navigators.

from a functional and design point of view, it makes sense that the navigator logic and the thumbnails be visible in the template of the gallery node (since the gallery/folder node "knows" its children, while the single image is displayed in a space of this template. But if static cache works as I think it does, I have to turn this structure backwards, and have the override template for the single image-node contain the navigator, and have the override folder for the gallery folder simply not be available for direct view, but redirect somehow to one of it's children node images.

I hope I have been clear - so, can anyone share their experience on this? and am I right in thinking so, or am I overlooking something / wrong on something?

thanks for your contributions and thoughts,

Massimiliano

Gabriel Ambuehl

Thursday 23 February 2006 6:41:19 am

This issue is pretty much a non issue when you know how static cache works [1]. It does, in fact (took me some messing with the code as per usual, but I believe in the end it boils down to this) SPIDER the site like any other spider would see it. So it sees exactly what YOU see on the site when you access it (as anonymous obviously).

If currently the links work ok, they very well should keep on doing so.

[1] If that is not correct, please excuse, it was many months ago that I played with this feature.

Visit http://triligon.org

Massimiliano Bariola

Thursday 23 February 2006 6:45:11 am

Thanks Buz, that actually seems a more sensible way of working, and it gets rid of a lot of problems! ;-)

if this is the case, I'll knock my bosses's socks off when I'll turn on that baby.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 01:16:09
Script start
Timing: Jan 31 2025 01:16:09
Module start 'layout'
Timing: Jan 31 2025 01:16:09
Module start 'content'
Timing: Jan 31 2025 01:16:10
Module end 'content'
Timing: Jan 31 2025 01:16:10
Script end

Main resources:

Total runtime0.7957 sec
Peak memory usage8,192.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.3594151.2266
Module start 'layout' 0.00450.0047 739.5859220.7188
Module start 'content' 0.00930.7858 960.30474,447.2031
Module end 'content' 0.79500.0007 5,407.507811.8125
Script end 0.7957  5,419.3203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4194160.0002
Check MTime0.00120.1567160.0001
Mysql Total
Database connection0.00070.083410.0007
Mysqli_queries0.710089.2261570.0125
Looping result0.00050.0612550.0000
Template Total0.740793.120.3703
Template load0.00190.239320.0010
Template processing0.738892.839620.3694
Template load and register function0.00120.156810.0012
states
state_id_array0.00160.204510.0016
state_identifier_array0.00150.189220.0008
Override
Cache load0.00160.2066280.0001
Sytem overhead
Fetch class attribute can translate value0.00180.229120.0009
Fetch class attribute name0.00170.211640.0004
XML
Image XML parsing0.00170.209020.0008
class_abstraction
Instantiating content class attribute0.00000.001350.0000
General
dbfile0.00180.2295170.0001
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs