Hi,

I'd like to be able to hide the 'title' and 'submitted by' lines on static
pages. To do that I modified the xtemplate.xtmpl file to dynamically remove
the 'title' and 'submitted by' lines on static pages. I tried to do this with
the following script:

<!-- BEGIN: node -->

<div class="node">

<?php

if ($node->type != 'page') {

echo '<div class="title"><a href="' . {link} . '">'
. {title} . '</a></div>';

echo '<span class="author">Submitted by ' . {author} . ' on
' . {date} . '.</span>';

echo '<span class="taxonomy">' . {taxonomy} . '</span>';

}

?>

<div class="content">{content}</div>

<div class="links">&raquo; {links}</div>

</div>

<!-- END: node -->

Problem with this latter approach is that it's not getting processed by the
php engine. My when testing this page forum entry the following output is generated:

Node Title | Site Title :( -- note: same as browser title

submitted by John Doe on dateX }?>:(

Ok, when I view source the entire php block is still present in the page sent
to the browser. That makes me thing that this change isn't being processed by
the php engine. Am I correct, and how do I work around this problem if so?

Thanks,

Mac

Comments

Ernest-1’s picture

Have you considered using the Style Module with the Polder Theme? You can disable the meta bar with a just a couple of mouse clicks. The style module is very handy, and simple to use. Also, the Polder theme works on all the Internet Explorer versions, as well as Netscape and Mozilla.

rinehart’s picture

I'll give that a shot. Thanks,

Mac

hystrix’s picture

I have not tried the polder theme and the style module, mostly cause I didn't understand the difference between it and the xtemplates theme.

Can you disable the meta bar for just static pages, without affecting other node types?

I find that this is the kind of request that is consistent with attempting to use Drupal for a non-community driven / "official" web site cms. I desired to also remove this "posted by" line, or at least move it below the post where it can be ignored by those who don't care.

duntuk’s picture

hmm...

celcode’s picture

I was trying to do the same thing. I'm using the excellent Marvin2K theme as a base. Here is the essence:

add this line to marvin_2k.theme, to the "$template->set_vars( " array that starts around line 144
"type" => $node->type,

Then make a conditional display in the template. In the case of Marvin, it wasn't creating the node type variable by default.

I wrote a larger article - Removing "posted by" based on node type that might help.

stewart-1’s picture

If you were to edit the page.module, say call it "staticdoc" and then alter the database adding a new table for "staticdoc", (basically page and staticdoc are identical but it'd be done just to keep them separate) and then alter the theme code to case select depending on "page" or "staticdoc" and if the node is of "staticdoc" have it leave out what you don't want to keep, this allows you to keep things separate from the other page variety. plus you could then setup new user permissions for this content type (staticdoc.module)...

Do you think this is possible?

xian’s picture

its true that it does not look good for official non-community driven websites to contain static pages which have the posted by username message.
i tried flexinode, but in there too i wan not able to remove the posted by username message, is there a solution to this?

kbahey’s picture

Since 4.5, we had a feature that allows you turn off the author and date on specific types of content.

Go to /admin/themes/settings, and check off the "Display Post Information" for the type you want .

--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

solipsist’s picture

How do you hide the title then?

Edit: Solved it, but it's partially hard-coded and is based on your taxonomic classification of pages so you'll have to build the site structure in taxonomy first.

in template.php

<?php
//generates the breadcrumb trail of the node in a plain format
function getBCTrail() {
	$bcpath = drupal_get_breadcrumb();
	$bcpath = implode('-', $bcpath);
	$bcpath = strip_tags($bcpath);
	$bcpath = strtolower($bcpath);
	$bcp_chars = array(" ","&",",");
	$bcp_replace = array("","","");
	return (str_replace($bcp_chars,$bcp_replace,$bcpath));
}

//hide title for certain section nodes
function hideTitle(){

	$sections = array(
		"home-pageone",
		"home-pagetwo",
		"home-pagethree"	
		);

	if (in_array(getBCTrail(),$sections)) { return true; }

}?>

in node.tpl.php

<h2><?php if (!hideTitle()) { print $title; } ?></h2>

--
Jakob Persson - blog
Leancept – Digital effect and innovation agency

myisha’s picture

How do you hide other nodes like filed under on static pages?

mdroste’s picture

On my sites I hide things I don't like with CSS.

.info
{display:none}

--
go with us - learn php

--
mdwp*

amitaibu’s picture

movado’s picture

Is it possible with PHP or a module to hide links in forum nodes? Or maybe just change the link to text only so they can't click it? I'de much rather hide content from anonymous users this way than deny access to a whole forums content.