Disable caching on module/view level?

Disable caching on module/view level?

Sunday 04 November 2007 3:13:28 am - 4 replies

Modified on Sunday 04 November 2007 3:15:09 am by Knut Urdalen

Author Message

André R.

Sunday 04 November 2007 6:45:10 am

ViewCache is cache for the content/view module, so has no effect on your custom module.
TemplateCache is the global setting for en/disabling cache-blocks, you can control your cache blocks from within your templates.

http://ez.no/doc/ez_publish/technical_manual/3_10/reference/template_functions/miscellaneous/cache_block

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Knut Urdalen

Monday 05 November 2007 5:42:34 am

Thanks for explaining the difference :)

I've tested a bit more now and enabling ViewCaching works fine. I use {cache-block} around the top menu and a site map at the bottom in pagelayout.tpl, while the {$module_result.content} do not use the cache-block mechanism.

However I have to set TemplateCache=disabled in order to get the result I want. My module script looks like this:

<?php
// 1. do stuff

// 2. setting some template variables
$tpl->setVariable('result', $result);
$tpl->setVariable('access_type', $GLOBALS['eZCurrentAccess']);

// 3. prepare result
$Result = array();
$Result['content'] = $tpl->fetch('design:mymodule/search_result.tpl');
?>

as described in this tutorial: http://ez.no/ezpublish/documentation/development/extensions/module/module_tutorial_part_1.

$result contains the correct new values, but those values is not set in $tpl->fetch() - the template remains in the previous state (when TemplateCache=enabled). Any ideas?

Knut Urdalen

Monday 05 November 2007 6:00:15 am

A related question to this topic is how can you include dynamic data from a custom fetch function inside a node template if you want to use ViewCaching in general, but some parts on some pages should not use it?

Use case: A content node includes some general meta data, but in addition you want to display some related content from an external data source that changes every minute.

Currently I use a node template with a custom fetch function - when ViewCaching=enabled the dynamic content remains in the view cache, while ViewCaching=disabled it's fetched again.

Any hints or tips?

Sujit Sth

Tuesday 04 January 2011 9:13:59 pm

Disable cache

Follow the following instruction.

1. Go to your template file:
eg:
E:\xampp\htdocs\ezpublish\settings\siteaccess\your_site\site.ini.append.php

2. Place the following code:

[DebugSettings]

DebugOutput=enabled

DebugRedirection=disabled

DebugToolbar=disabled

DebugByIP=disabled

DebugByUser=disabled

[TemplateSettings]

TemplateCompile=disabled

TemplateCache=disabled

DevelopmentMode=disabled

ShowUsedTemplates=enabled

Debug=disabled

ShowXHTMLCode=disabled

[ContentSettings]

ViewCaching=disabled

[DatabaseSettings]

SQLOutput=disabled

[DebugSettings]

DebugOutput=enabled

DebugRedirection=disabled

DebugToolbar=disabled

DebugByIP=disabled

DebugByUser=disabled

[TemplateSettings]

TemplateCompile=disabled

TemplateCache=disabled

DevelopmentMode=disabled

ShowUsedTemplates=enabled

Debug=disabled

ShowXHTMLCode=disabled

[ContentSettings]

ViewCaching=disabled

[DatabaseSettings]

SQLOutput=disabled

<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; white-space: normal; font-size: 13px; " mce_fixed="1">Go and enjoy the code !!!!!!</span>

For detail follow the link below:

http://blog.developeronhire.com/tag/disble-cache/

Regards,

Sujeet

You must be logged in to post messages in this topic!

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