In libraries\joomla\cache\controller\callback.php
The function "get" in line 148 contains:
$coptions['headerbefore'] = $document->getHeadData();
There are cases when using cache in the module:
$list = JModuleHelper::moduleCache($module, $params, $cacheparams);
And calling this module render:
JModuleHelper::renderModule($module);
The module should render correctly.
Getting: Fatal error: Call to undefined method JDocumentRaw::getHeadData() in C:\xampp\htdocs\xxxx\libraries\joomla\cache\controller\callback.php on line 148
Joomla 3.3.6
Can be solved by using:
if (method_exists($document, 'getHeadData')){
$coptions['headerbefore'] = $document->getHeadData();
}
Thanks for your reply.
I'm using AJAX call to refresh a module.
In javascript I use the following:
function moduleRefreshSendAjax (moduleName, moduleId, modulePosition, num){
var data = {
"option": "com_ajax",
"module": moduleName,
"method": "refresh",
"moduleid": moduleId,
"position": modulePosition,
"format": "raw"
};
jQuery.ajax({
type: "POST",
data: data,
success: function (res) {
jQuery('.news-' + moduleId).html(res);
},
error: function (res) {
console.log("ERROR: " + res.responseText);
}
});
};
And in the server side I use the following method:
public static function refreshAjax() {
$position = $_POST['position'];
$moduleId = $_POST['moduleid'];
$modules =& JModuleHelper::getModules($position);
foreach ($modules as $module) {
if ($module->id == $moduleId) {
return JModuleHelper::renderModule($module);
}
}
}
Is there other good solution to return module HTML from ajax call?
Thanks in advanced
Ah I see. hat should be a valid usecase indeed. Can you make a PR with your suggested changes?
If you never did a Pull Request before, you can have a look at this doc: https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests
Labels |
Added:
?
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-02-12 21:18:43 |
Closed_By | ⇒ | zero-24 |
Closing here as we have a Pull Request by @islavi here: #6045 Thanks!
Set to "closed" on behalf of @zero-24 by The JTracker Application at issues.joomla.org/joomla-cms/6028
Closed_Date | 2015-02-12 21:18:43 | ⇒ | 2015-02-12 21:18:49 |
The raw document type doesn't support headers, thus the missing method.
What I wonder is how you end up calling a module in the document type "raw" (JDocumentRaw). That sounds more like a bug in the extension to me. JDocumentRaw certainly isn't meant to produce HTML pages (containing modules and all).
You suggested code likely would work in that it doesn't create a fatal error anymore. However I don't think it's the best idea as it looks more like a workaround for messy coding in another place.