Joomla: Is there a module render plugin event?

旧巷老猫 提交于 2019-12-11 09:44:59

问题


Due to some caching issues, I need to explicitly bypass the cache, for a specific module, if certain URL parameters are present. The workaround I've arrived at is to hack the render() function in libraries/joomla/document/html/renderer/module.php, along the lines of:

function render( $module, $params = array(), $content = null )
{
    // Existing code:
    $mod_params = new JParameter( $module->params );

    // My hack:
    if ($module->module == 'mod_foo')
    {
        if (certain URL parameters are present)
        {
            $mod_params->set('cache', 0);
        }
    }
    ...
}

Of course, hacking the core joomla code is a terrible idea, one which I'd like to avoid if at all possible. So, is there an appropriate hook I can plugin to in order to achieve the same? I don't think I can do anything at the module level, since it won't even be inspected if the renderer has already decided to fetch it from cache.


回答1:


To answer the first question no there isn't a module render event, here's the plugin doc's and the list of events in Joomla!

Turn off caching for your module.

See this article on The Art Of Joomla, additional articles you could look at:

  1. Using Cache to Speed Up your code

  2. JCache API



来源:https://stackoverflow.com/questions/9021148/joomla-is-there-a-module-render-plugin-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!