You are here

function contemplate_node_views in Content Templates (Contemplate) 5

Same name and namespace in other branches
  1. 6 contemplate.module \contemplate_node_views()
  2. 7 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 572
Create templates to customize teaser and body content.

Code

function contemplate_node_views($type) {

  // get the nid of the latest node of this type
  $nid = db_result(db_query("SELECT nid FROM {node} WHERE type = '%s' ORDER BY created DESC", $type));
  if ($nid) {
    $bodynode = contemplate_node_view(node_load($nid), FALSE, TRUE);
    $teasernode = contemplate_node_view(node_load($nid), TRUE, FALSE);
    return array(
      'body' => $bodynode,
      'teaser' => $teasernode,
    );
  }
  else {
    return FALSE;
  }
}