template.php
/**
* Preproccess for Page
*/
function mytheme_process_page(&$variables) {
// Node type Article title
if (!empty($variables['node']) && $variables['node']->type == 'article') {
//kpr($variables['node']);
$long_title = $variables['node']->field_long_title[LANGUAGE_NONE][0]['safe_value'];
$variables['title'] = $long_title;
}
}
function mytheme_preprocess_node(&$variables, $hook) {
// Node type Article
if ($variables['node']->type == 'article') {
//kpr($variables);
// Getting taxonomy term (only one)
$tid = $variables['field_categories'][LANGUAGE_NONE][0]['tid'];
$term = taxonomy_term_load($tid); // load term object
$term_uri = taxonomy_term_uri($term); // get array with path
$term_title = taxonomy_term_title($term);
$term_path = $term_uri['path'];
$article_link = l($term_title,$term_path);
// Change date format
$article_date = date("F d. Y", $variables['created']);
// Block (#1)
$block = module_invoke('block','block_view','1');
$block_whole = block_load('block','1'); // not really the whole block until render
// Views block ("test")
$views_block = module_invoke('views','block_view','test_view-block');
// Creating custom variables for node.tpl.php
$variables['article_link'] = $article_link;
$variables['article_date'] = $article_date;
$variables['block'] = $block;
$variables['block_whole'] = $block_whole;
$variables['views_block'] = $views_block;
}
}node--article.tpl.php
<div><?php print $article_link ." | ". $article_date; ?></div> <?php print render($block['content']); print drupal_render(_block_get_renderable_array(_block_render_blocks(array($block_whole)))); print render($views_block); ?> <?php // Hide the comments and links //hide($content['comments']); //hide($content['links']); // Render comments and links print render($content['links']); print render($content['comments']); ?>