function _scratchy_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page)
{
    global $user;
    // forum list, topics list, topic browser and 'add new topic' link
    $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));
    $title = $vocabulary->name;
    // Breadcrumb navigation:
    $breadcrumb = array();
    if ($tid) {
        $breadcrumb[] = array('path' => 'forum', 'title' => $title);
    }
    if ($parents) {
        $parents = array_reverse($parents);
        foreach ($parents as $p) {
            if ($p->tid == $tid) {
                $title = $p->name;
            } else {
                $breadcrumb[] = array('path' => 'forum/' . $p->tid, 'title' => $p->name);
            }
        }
    }
    drupal_set_title(check_plain($title));
    $breadcrumb[] = array('path' => $_GET['q']);
    menu_set_location($breadcrumb);
    if (count($forums) || count($parents)) {
        $output = '<div class="node">
  <div class="boxtop"><div class="bc ctr"></div><div class="bc ctl"></div></div>
  <div class="boxcontent">
    <div class="subboxcontent"><div class="content"><div id="forum"><ul style="margin-top:0">';
        if (user_access('create forum topics')) {
            $output .= '<li>' . l(t('Post new forum topic.'), "node/add/forum/{$tid}") . '</li>';
        } else {
            if ($user->uid) {
                $output .= '<li>' . t('You are not allowed to post a new forum topic.') . '</li>';
            } else {
                $output .= '<li>' . t('<a href="@login">Login</a> to post a new forum topic.', array('@login' => url('user/login', drupal_get_destination()))) . '</li>';
            }
        }
        $output .= '</ul>';
        $output .= theme('forum_list', $forums, $parents, $tid);
        if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
            $output .= theme('forum_topic_list', $tid, $topics, $sortby, $forum_per_page);
            drupal_add_feed(url('taxonomy/term/' . $tid . '/0/feed'), 'RSS - ' . $title);
        }
        $output .= '</div></div></div>
  </div>
  <div class="boxbtm">
    <div class="bc cbr"></div>
    <div class="bc cbl"></div>
  </div>
</div>';
    } else {
        drupal_set_title(t('No forums defined'));
        $output = '';
    }
    return $output;
}
Exemple #2
0
/**
 * Display a node.
 *
 * This is a hook used by node modules. It allows a module to define a
 * custom method of displaying its nodes, usually by displaying extra
 * information particular to that node type.
 *
 * @param $node
 *   The node to be displayed, as returned by node_load().
 * @param $build_mode
 *   Build mode, e.g. 'full', 'teaser', ...
 * @return
 *   $node. The passed $node parameter should be modified as necessary and
 *   returned so it can be properly presented. Nodes are prepared for display
 *   by assembling a structured array, formatted as in the Form API, in
 *   $node->content. As with Form API arrays, the #weight property can be
 *   used to control the relative positions of added elements. After this
 *   hook is invoked, node_build() calls field_attach_view() to add field
 *   views to $node->content, and then invokes hook_node_view() and
 *   hook_node_build_alter(), so if you want to affect the final
 *   view of the node, you might consider implementing one of these hooks
 *   instead.
 *
 * For a detailed usage example, see node_example.module.
 */
function hook_view($node, $build_mode = 'full')
{
    if ((bool) menu_get_object()) {
        $breadcrumb = array();
        $breadcrumb[] = array('path' => 'example', 'title' => t('example'));
        $breadcrumb[] = array('path' => 'example/' . $node->field1, 'title' => t('%category', array('%category' => $node->field1)));
        $breadcrumb[] = array('path' => 'node/' . $node->nid);
        menu_set_location($breadcrumb);
    }
    $node->content['myfield'] = array('#value' => theme('mymodule_myfield', $node->myfield), '#weight' => 1);
    return $node;
}
			
			<div id="content-wrapper">
				<div id="content-wrapper-1">
				
					<?php 
if ($breadcrumb) {
    ?>
						<div class="breadcrumb">
							<strong>You are here:</strong>
							<?php 
    if ($node->type == 'forum') {
        ?>
								<?php 
        $bc = array();
        $bc[] = array('path' => $_GET['q']);
        menu_set_location($bc);
        ?>
							<?php 
    } elseif (arg(0) == 'blog') {
        ?>
								<?php 
        $title = 'Captain\'s Blog';
        ?>
							<?php 
    } elseif (arg(0) == 'comment' && arg(1) == 'reply') {
        ?>
								<?php 
        $title = 'Reply';
        ?>
							<?php 
    }
Exemple #4
0
/**
 * Display a node.
 *
 * This is a hook used by node modules. It allows a module to define a
 * custom method of displaying its nodes, usually by displaying extra
 * information particular to that node type.
 *
 * @param $node
 *   The node to be displayed.
 * @param $teaser
 *   Whether we are to generate a "teaser" or summary of the node, rather than
 *   display the whole thing.
 * @param $page
 *   Whether the node is being displayed as a standalone page. If this is
 *   TRUE, the node title should not be displayed, as it will be printed
 *   automatically by the theme system. Also, the module may choose to alter
 *   the default breadcrumb trail in this case.
 * @return
 *   $node. The passed $node parameter should be modified as necessary and
 *   returned so it can be properly presented. Nodes are prepared for display
 *   by assembling a structured array in $node->content, rather than directly
 *   manipulating $node->body and $node->teaser. The format of this array is
 *   the same used by the Forms API. As with FormAPI arrays, the #weight
 *   property can be used to control the relative positions of added elements.
 *   If for some reason you need to change the body or teaser returned by
 *   node_prepare(), you can modify $node->content['body']['#value']. Note
 *   that this will be the un-rendered content. To modify the rendered output,
 *   see hook_nodeapi($op = 'alter').
 *
 * For a detailed usage example, see node_example.module.
 */
function hook_view($node, $teaser = FALSE, $page = FALSE)
{
    if ($page) {
        $breadcrumb = array();
        $breadcrumb[] = array('path' => 'example', 'title' => t('example'));
        $breadcrumb[] = array('path' => 'example/' . $node->field1, 'title' => t('%category', array('%category' => $node->field1)));
        $breadcrumb[] = array('path' => 'node/' . $node->nid);
        menu_set_location($breadcrumb);
    }
    $node = node_prepare($node, $teaser);
    $node->content['myfield'] = array('#value' => theme('mymodule_myfield', $node->myfield), '#weight' => 1);
    return $node;
}