Пример #1
0
function story_render($id, $cid)
{
    global $theme, $user;
    $story = db_fetch_object(db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = '{$id}'"));
    if (story_visible($story)) {
        $theme->story($story, "[ <A HREF=\"story.php?op=reply&id={$id}&pid=0\">" . t("reply to this story") . "</A> ]");
        comment_render($id, $cid);
    } else {
        $theme->box(t("Warning message"), t("The story you requested is not available or does not exist."));
    }
}
Пример #2
0
function wistar_preprocess_node(&$vars) {
	$node = $vars['node'];

	if( $vars['node'] ) {
		$vars['template_files'][] = 'node-' . $vars['node']->nid;
	}

	$vars['node']->comment = $vars['node']->comments = $vars['node']->comment_form = 0;
	if (module_exists('comment') && isset($vars['node'])) {
		$vars['node']->comments = comment_render($vars['node']);
		$vars['node']->comment_form = drupal_get_form('comment_form',array('nid' => $vars['node']->nid));
	}

	$node->comment = 0;

	if($vars['node']->type=='newsletter') {
		$crumbs = drupal_get_breadcrumb();
		array_pop($crumbs);
		$crumbs[] = l('Wistar Today', 'wistar-today');
		$crumbs[] = l('News and Media', 'news-and-media');
		$crumbs[] = l('Focus Newsletter', 'news-and-media/focus-newsletter');
		$crumbs[] = $vars['node']->title;
		drupal_set_breadcrumb($crumbs);
	}

	if($node->type=='article') {
		$crumbs = drupal_get_breadcrumb();
		array_pop($crumbs);
		$crumbs[] = l('Wistar Today', 'wistar-today');
		$crumbs[] = l('News and Media', 'news-and-media');
		$crumbs[] = l('Focus Newsletter', 'news-and-media/focus-newsletter');
		//pa($node->field_article_newsletter[0]['nid'],1);
		if(!empty($node->field_article_newsletter[0]['nid'])){
			$node_newsletter = node_load($node->field_article_newsletter[0]['nid']);
			if(!empty($node_newsletter->field_newsletter_date[0]['value'])){
				$crumbs[] = l($node_newsletter->field_newsletter_date[0]['value'], $node_newsletter->path);
			}
		}
		$crumbs[] = $node->title;
		drupal_set_breadcrumb($crumbs);
	}
}
Пример #3
0
function phptemplate_preprocess_page($vars) {
  if (isset($vars['node'])) {
    $vars['comments'] = comment_render($vars['node']);
  }
}
Пример #4
0
function boinc_preprocess_page(&$vars, $hook)
{
    // Expose comments to template files; this is needed so that comments can be
    // rendered in locations other than directly below the node content
    $vars['comments'] = $vars['comment_form'] = '';
    if (module_exists('comment') && isset($vars['node'])) {
        $vars['comments'] = comment_render($vars['node']);
        $vars['comment_form'] = drupal_get_form('comment_form', array('nid' => $vars['node']->nid));
    }
    // Determine locale region code so the correct flag is displayed in footer
    global $language;
    global $theme_path;
    $locality = $language->language;
    if (strpos($language->language, '-')) {
        $flag_icon = "{$theme_path}/images/flags/{$language->language}.png";
        if (!file_exists($flag_icon)) {
            $lang_code = explode('-', $language->language);
            $locality = $lang_code[0];
        }
    }
    $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png";
    $server_status_url = variable_get('boinc_server_status_url', '');
    if (!$server_status_url) {
        $server_status_url = 'server_status.php';
    }
    $vars['server_status_url'] = $server_status_url;
    $app_list_url = variable_get('boinc_app_list_url', '');
    if (!$app_list_url) {
        $app_list_url = 'apps.php';
    }
    $vars['app_list_url'] = $app_list_url;
    // Remove title from search page
    if (arg(0) == 'search') {
        unset($vars['title']);
    }
    // Apply classes to tabs to allow for better styling options
    $tabs = explode("\n", $vars['tabs']);
    array_pop($tabs);
    end($tabs);
    $last_key = key($tabs);
    foreach ($tabs as $key => &$tab) {
        if (strpos($tab, 'li class=')) {
            if ($key == 0) {
                $tab = str_replace('li class="', 'li class="first ', $tab);
            }
            if ($key == $last_key) {
                $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>';
            }
        } elseif (strpos($tab, 'li ')) {
            if ($key == 0) {
                $tab = str_replace('li ', 'li class="first" ', $tab);
            }
            if ($key == $last_key) {
                $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>';
            }
        }
    }
    $vars['tabs'] = implode("\n", $tabs);
}
Пример #5
0
    print $content;
    ?>
        <?php 
    if ($signature and $show_signatures) {
        ?>
          <div class="user-signature clearfix">
            <?php 
        print $signature;
        ?>
          </div>
        <?php 
    }
    ?>
      </div>

            
    </div> <!-- /.node-body -->
    
  <?php 
}
// page with topic starter post
?>
  
  <?php 
if ($oldest_post_first) {
    print comment_render($node);
}
?>
  
</div> <!-- /.node -->
Пример #6
0
function phptemplate_preprocess_page(&$vars)
{
    //allow for templates by path
    $vars['tabs2'] = menu_secondary_local_tasks();
    if (module_exists('path')) {
        $alias = drupal_get_path_alias(str_replace('/edit', '', $_GET['q']));
        if ($alias != $_GET['q']) {
            $suggestions = array();
            $template_filename = 'page';
            foreach (explode('/', strtolower($alias)) as $path_part) {
                $template_filename = $template_filename . '-' . $path_part;
                $suggestions[] = $template_filename;
            }
            $vars['template_files'] = array_merge((array) $suggestions, $vars['template_files']);
        }
    }
    //unrelated feature to split comments out of $content so they can be displayed differently
    if ($vars['node']->type == "subscription_article") {
        $vars['comments'] = $vars['comment_form'] = '';
        /*if (module_exists('comment') && isset($vars['node'])) {*/
        $vars['comments'] = comment_render($vars['node']);
        $vars['comment_form'] = drupal_get_form('comment_form', array('nid' => $vars['node']->nid));
        /*}*/
    }
}