Closed (won't fix)
Project:
Live Update
Version:
6.x-1.x-dev
Component:
Live Update API
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Aug 2009 at 13:47 UTC
Updated:
24 Sep 2009 at 01:33 UTC
Thanks for this incredibly handy little module. I'm working on code for a live Q&A, and it's working as advertised except I can't seem to theme the node when it's inserted via live_update_update_content().
This may be more of a node_api question, but node_view seems to ignore my theme's node-.tpl.php file when used within the hook. Any suggestions?
Here is my implementation of hook_nodeapi(), based on the blog tutorial.
Thanks!
/**
* Implementation of hook_nodeapi()
*
*/
function live_chat_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if ($op == 'update' && $node->type == 'chat') {
if ($node->field_chat_answer[0]['value']) {
$html = node_view($node, TRUE, FALSE, FALSE);
$settings = array(
'target' => '.view-id-chat',
'method' => 'append',
);
live_update_update_content('live-update-chat', $html, $settings);
$html = '<div id="latest-qa">' . $html . '</div>';
$settings = array(
'target' => '#latest-qa',
'method' => 'replaceWith',
);
live_update_update_content('live-update-chat', $html, $settings);
}
}
}
Comments
Comment #1
jtolj commentedNever was able to figure this out, haven't had time to dig into node_view() to see why this was happening... I ended up just building the themed html within the $html variable from $node->fields.
Definitely not ideal, but it does work.
Comment #2
jonskulski commentedThis is not a live update issue, so I'm going to close it. But...
It is the theme that is responsible, and this is not built into the default theme('node'). Perhaps garland does this by default, but node.module does not.