[support] The best place to edit the node title?

Gerhard Killesreiter gerhard at killesreiter.de
Fri Sep 14 16:18:25 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Laura Scott schrieb:
> On Sep 14, 2007, at 8:56 AM, Augustin (Beginner) wrote:
> 
>> On Thursday 13 September 2007 19:49, Earnie Boyd wrote:
>>> Quoting "Augustin (Beginner)" <drupal.beginner at wechange.org>:
>>>> <?php if ($node->title_prepend): print '<span class="node-label">'.
>>>> $node->title_prepend .' </span>'; endif; ?>
>>> Don't you need to protect against the non-existence of
>>> $node->title_prepend or is it guaranteed to be present at this point?
>> You are right. I am supposed to use isset().
>>
>>> <code>
>>> <?php if (isset($node->title_prepend)): print '<span class="node- 
>>> label">'.
>>> $node->title_prepend .' </span>'; endif; ?>
>>> </code>
>>>
>>> And you want to prettify this code.
> 
> Here's a simpler solution (I think) but maybe this approach has been  
> deprecated as it's something I used back in the 4.6 days....
> 
> <?php print $node->type ?>
> 

In the 4.6 days we didn't have node types which where named by users in
core. Now that we have them, $node->type should be regarded as user
input and sanitized on output:

<?php print check_plain($node->type); ?>

Cheers,
	Ger»yes, it may seem overzealous«hard
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG6rRRfg6TFvELooQRAnHHAJ9+rotGDVIJcyW3Z7G6U0T5KlyN4QCdFmS0
OYfyWo9A8+iLbtR9nvoC3Vk=
=ZiaO
-----END PGP SIGNATURE-----


More information about the support mailing list