I have read all the previous posts, and tried hard to do this on my own, but could not get it to work!
I want to remove the title from displaying on a specific page (the home page). I have clean urls running. In site config, I have changed my my front page from 'node' to 'home.'
I have created a page with url 'home.'
I created a page-home.tpl.php file with the title removed. The title still shows.
I need some help! What am I or possibly my template.php file missing here?
THANKS!
Here are the template, page, and node php files:
template.tpl.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------
<?php
/**
* Sets the body-tag class attribute.
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($sidebar_left, $sidebar_right) {
if ($sidebar_left != '' && $sidebar_right != '') {
$class = 'sidebars';
}
else {
if ($sidebar_left != '') {
$class = 'sidebar-left';
}
if ($sidebar_right != '') {
$class = 'sidebar-right';
}
}
if (isset($class)) {
print ' class="'. $class .'"';
}
}
/**
* Allow themable wrapping of all comments.
*/
function phptemplate_comment_wrapper($content, $type = null) {
static $node_type;
if (isset($type)) $node_type = $type;
if (!$content || $node_type == 'forum') {
return '<div id="comments">'. $content . '</div>';
}
else {
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
}
}
/**
* Override or insert PHPTemplate variables into the templates.
*/
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
if ($secondary = menu_secondary_local_tasks()) {
$output = '<span class="clear"></span>';
$output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
$vars['tabs2'] = $output;
}
// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
return $vars;
}
return array();
}
/**
* Returns the rendered local tasks. The default implementation renders
* them as tabs.
*
* @ingroup themeable
*/
function phptemplate_menu_local_tasks() {
$output = '';
if ($primary = menu_primary_local_tasks()) {
$output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
}
return $output;
}
function phptemplate_menu_tree($pid = 1) {
$msm = variable_get('menu_secondary_menu', 0);
if ($tree = menu_tree($pid)) {
$ul = $msm == $pid ? '<ul>' : '<ul class="menu">';
return "\n$ul\n$tree\n</ul>\n";
}
}
function phptemplate_menu_item($mid, $children = '', $leaf = TRUE) {
$msm = variable_get('menu_secondary_menu', 0);
$menu = menu_get_menu();
if (in_array($mid, $menu['visible'][$msm]['children'])) {
return '<li>'. menu_item_link($mid) . $children ."</li>";
} else {
return '<li class="'. ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) .'">'. menu_item_link($mid) . $children ."</li>\n";
}
}
/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
foreach ($breadcrumb as $crumb) {
$output .= "<li>$crumb</li>";
}
return $output;
}
}
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
page.tpl.php
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language ?>" lang="<?php print $language ?>">
<!-- Version: Multiflex-3 Update-7 / Layout-4 -->
<!-- Date: January 15, 2007 -->
<!-- Author: Wolfgang -->
<!-- License: Fully open source without restrictions. -->
<!-- Please keep footer credits with a link to -->
<!-- Wolfgang (www.1-2-3-4.info). Thank you! -->
<!-- Modified for Drupal 5.0 by Christopher Doyle -->
<head>
<title><?php print $head_title ?></title>
<?php print $head ?>
<?php print $styles ?>
<?php print $scripts ?>
<style type="text/css">@import "<?php print base_path() . path_to_theme() ?>/css/layout4_setup.css";</style>
<style type="text/css">@import "<?php print base_path() . path_to_theme() ?>/css/layout4_text.css";</style>
<style type="text/css">@import "<?php print base_path() . path_to_theme() ?>/css/style.css";</style>
<style type="text/css">@import "<?php print base_path() . path_to_theme() ?>/css/site.css";</style>
</head>
<!-- Global IE fix to avoid layout crash when single word size wider than column width -->
<!--[if IE]><style type="text/css"> body {word-wrap: break-word;}</style><![endif]-->
<body<?php //print phptemplate_body_class($sidebar_left, $sidebar_right); ?>>
<!-- Main Page Container -->
<div class="page-container">
<!-- For alternative headers START PASTE here -->
<!-- A. HEADER -->
<div class="header">
<!-- A.1 HEADER TOP -->
<div class="header-top">
<!-- Sitelogo and sitename -->
<?php
$site_name = check_plain($site_name);
$base_path = check_url($base_path);
$logo = check_url($logo);
if ($site_name && $logo) {
print "
<a class=\"sitelogo\" href=\"$base_path\" title=\"$site_name\"><img src=\"$logo\" alt=\"$site_name\" id=\"logo\" /></a>";
}
print "
<div class=\"sitename\">";
print "
<h1><a href=\"$base_path\" title=\"$site_name\">$site_name</a></h1>
</div>";
?>
<!-- Navigation Level 0 -->
<!-- <div class="nav0">
<ul>
<li><a href="#" title="Pagina home in Italiano"><img src="./img/flag_italy.gif" alt="Image description" /></a></li>
<li><a href="#" title="Homepage auf Deutsch"><img src="./img/flag_germany.gif" alt="Image description" /></a></li>
<li><a href="#" title="Hemsidan på svenska"><img src="./img/flag_sweden.gif" alt="Image description" /></a></li>
</ul>
</div>-->
<!-- Navigation Level 1 -->
<?php if (isset($primary_links)) : ?>
<?php print theme('links', $primary_links, array('class' => 'nav1')) ?>
<?php endif; ?>
</div>
<!-- A.2 HEADER MIDDLE -->
<div class="header-middle">
<!-- Site message -->
<div class="sitemessage">
<?php if ($site_slogan): ?>
<h1><?php print $site_slogan; ?></h1>
<?php endif; ?>
<?php $mission = variable_get('site_mission', ''); if ($mission): ?>
<h2><?php print $mission; ?></h2>
<?php endif; ?>
</div>
</div>
<!-- A.3 HEADER BOTTOM -->
<div class="header-bottom">
<!-- Navigation Level 2 (Drop-down menus) -->
<div class="nav2">
<!-- Navigation items -->
<?php if (isset($secondary_links)) {
// build two level menu for secondary links
//TODO: there will almost certainly be an IE6/IE7 problem with
// these menus... see the original template on how to fix
$msm = variable_get('menu_secondary_menu', 0);
print theme('menu_tree', $msm);
} ?>
</div>
</div>
<!-- A.4 HEADER BREADCRUMBS -->
<!-- Breadcrumbs -->
<div class="header-breadcrumbs">
<ul>
<?php
if ($breadcrumb):
print $breadcrumb;
if ($title != '') {
print " <li>$title</li>";
}
endif; ?>
</ul>
<!-- Search form -->
<?php if ($search_box) :?>
<div class="searchform">
<?php print $search_box; ?>
</div>
<?php endif; ?>
<?php if ($header) { print $header; } ?>
</div>
</div>
<!-- For alternative headers END PASTE here -->
<!-- B. MAIN -->
<?php
if (!$sidebar_left && !$sidebar_right) {
$wide_class = ' doublewide';
} else if (!$sidebar_left) {
$wide_class = ' nonav';
} else if (!$sidebar_right) {
$wide_class = ' noblocks';
}
?>
<div class="main<?php print $wide_class; ?>">
<!-- B.1 MAIN NAVIGATION -->
<?php if ($sidebar_left): ?>
<div class="main-navigation sidebar" id="sidebar-left">
<?php print $sidebar_left ?>
</div>
<?php endif; ?>
<!-- B.1 MAIN CONTENT -->
<div class="main-content">
<!-- Pagetitle -->
<?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?>
<?php if ($title): print '<h1'. ($tabs ? ' class="with-tabs pagetitle"' : ' class="pagetitle"') .'>'. $title .'</h1>'; endif; ?>
<?php if ($tabs): print $tabs .'</div>'; endif; ?>
<?php if (isset($tabs2)): print $tabs2; endif; ?>
<!-- Content unit - One column -->
<!-- <h1 class="block"><?php //$title; ?></h1> -->
<div class="column1-unit">
<?php if ($help): print $help; endif; ?>
<?php if ($messages): print $messages; endif; ?>
<?php print $content ?>
<span class="clear"></span>
<?php print $feed_icons ?>
</div>
</div>
<!-- B.3 SUBCONTENT -->
<?php if ($sidebar_right): ?>
<div class="main-subcontent sidebar" id="sidebar-right">
<?php print $sidebar_right ?>
</div>
<?php endif; ?>
</div>
<!-- C. FOOTER AREA -->
<div id="footer" class="footer">
<p><?php print $footer_message ?></p>
<p class="credits">Theme by Wolfgang</a> | Content by Bell Creek Community Church Copyright 2007 | Powered by <a href="http://drupal.org" title="Drupal">Drupal</a></p>
</div>
</div>
</body>
</html>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
node.tpl.php
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?php phptemplate_comment_wrapper(NULL, $node->type); ?>
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<?php print $picture ?>
<?php if ($page == 0): ?>
<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<div class="content">
<?php print $content ?>
</div>
<div class="clear-block clear">
<div class="meta">
<?php if ($taxonomy): ?>
<div class="terms"><?php print $terms ?></div>
<?php endif;?>
</div>
<?php if ($links): ?>
<div class="links"><?php print $links; ?></div>
<?php endif; ?>
</div>
</div>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Comments
=-=
added code tags so that the HTML was not stripped
have you read: http://drupal.org/node/138910 ?
_____________________________________________________________________
Confucius says:
"Those who seek drupal answers should use drupal search!" : )
Thanks for the response - I
Thanks for the response - I had not read that snippet! I am still at a loss, however. I do not want to remove the titles from every page node, I just want to remove the title from one specific page. Thanks for directing me to this resource, but I still don't see the answer!
=-=
What I directed you to, does not hide all node titles. It hides specific content type node titles.
That being said, what one could do, is create a content type in administer -> content types -> add
call this content type home pages
then use the snippet to hide the title on that specific content type
later in future if you choose to change the "home" page you can do so and the title will still be "hidden".
A search for "hide title" produces many threads, maybe another method would suit you better in the returned search results.
_____________________________________________________________________
Confucius says:
"Those who seek drupal answers should use drupal search!" : )
I appreciate the help.
I appreciate the help. That's a good tip and another way to accomplish this. I found a simpler solution. I was making the mistake of naming my tpl.php file 'page-home-tpl.php' when I should have named it page-front.tpl.php.
So, for those looking for a simple solution to remove the title from their home page, go to your theme folder, find the page.tpl.php file. Copy it and name it 'page-front.tpl.php' Find the section where the page title is printed. In my page.tph.php file, this was here:
if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif;if ($tabs): print $tabs .'</div>'; endif;if (isset($tabs2)): print $tabs2; endif;I removed:
if ($title): print '<h1'. ($tabs ? ' class="with-tabs pagetitle"' : ' class="pagetitle"') .'>'. $title .'</h1>'; endif;put page-front.tpl.php into my theme folder, and everything worked out fine.