function contemplate_node_views in Content Templates (Contemplate) 7
Same name and namespace in other branches
- 5 contemplate.module \contemplate_node_views()
- 6 contemplate.module \contemplate_node_views()
Load an example node and display its parts
- used only on template edit page
Parameters
$type: node type
Return value
array
1 call to contemplate_node_views()
- contemplate_examples in ./
contemplate.module - Load an example node and display its parts
File
- ./
contemplate.module, line 679 - Create templates to customize teaser and body content.
Code
function contemplate_node_views($type) {
// get the nid of the latest node of this type
$result = db_query("SELECT nid FROM {node} WHERE type = :type ORDER BY created DESC", array(
':type' => $type,
));
foreach ($result as $record) {
$nid = $record->nid;
}
if (isset($nid) && $nid) {
//$bodynode = contemplate_template_node_view(node_load($nid), 'full');
//$teasernode = contemplate_template_node_view(node_load($nid), 'teaser');
$teasernode = $bodynode = node_load($nid);
$bodynode->build = node_view($bodynode, 'full');
$bodynode->build = node_view($teasernode, 'teaser');
return array(
'body' => $bodynode,
'teaser' => $teasernode,
);
}
else {
return FALSE;
}
}