Hi there' I'm trying to show my title on everypage except 3 pages, but when i try to put my print $title in a block, it seems to strip the php. Even when my input format is PHP

Does anyone have any ideas why this is happening, or how I can show my title on everypage except 3 specific pages?

Thanks, Justin

Comments

danielb’s picture

<?php
print drupal_get_title();
?>

How would you know if it 'strips' the PHP -- it's not like you can see PHP code in your HTML source, especially when it doesn't do anything (like the code you posted).

hinchcliffe’s picture

The code I posted prints the title I use it in my page.tpl.php

			<div id="title">
				<?php if ($title != ""): ?>
				<h2><?php print $title ?></h2>
				<?php endif; ?>
			</div>

I use this code in my page.tpl.php, now when I add this code to a block it strips the php. I can tell because the

shows
<div id="title"></div> but it doesn't show my title.

******EDIT --- I'm not sure why it removes the $title and the other one works, thanks for the code though. Works fine now with
print drupal_get_title();

styro’s picture

has no idea what the $title variable is - it is a brand new empty variable as far as it is concerned. The variables you can use in a block are not the same as what you can use in PHPTemplate files - each template is given a bunch of variables suited for that template.

PHPTemplate variables don't exist outside the template. The PHPTemplate variables are theme related and are populated after the blocks and nodes have been generated anyway.

--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal