To summarize this discussion, in order to have HTML in the title field of a node, one needs to either:
1) Use CCK field and a contrib module to override Drupal's title. Drupal titles still appear here and there, so you need to run after each appearance and theme it (hopefully you can)
2) Hack core, specifically check_plain() and a couple other places & modules.
Since I believe this is not such a remote requirement (the nyobserver and my own case are from the news industry), I suggest to have this support in core.
Even if this will not be accepted in core eventually, a patch for such support could be useful.
Comment | File | Size | Author |
---|---|---|---|
#4 | 211475.patch | 951 bytes | Owen Barton |
Comments
Comment #1
drupalchamp@general.motors CreditAttribution: drupalchamp@general.motors commentedSTYLE TITLE OF NODE
Steps needs to be followed:
Open page.tpl.php of your current theme. In my case it is garland.
Put the following line of php code snippet.
Comment #2
yhager CreditAttribution: yhager commentedYes, it shouldn't be much more complicated than that piece of code, but page.tpl.php is not where it should reside. Since titles are used also on RSS feeds, page titles, admin screens, views resutls etc.
Comment #3
Owen Barton CreditAttribution: Owen Barton commentedSubscribing
Comment #4
Owen Barton CreditAttribution: Owen Barton commentedHere is a patch to allow very very minimal HTML in titles. Will likely break tests, I haven't checked.
This is not core worthy, since I assume we would want some kind of interface to configure valid "inline" tags (or whatever we want to call this), and we would need to parse this and store it in a static. Rather than modifying check_plain we might want to have a check_plain_inline or something, and switch all the node title calls to use this instead. Either way we need to keep this very simple, fast and safe since this function is called a zillion times. Any ideas on where the interface for this might live?
Hopefully this will spark some discussion anyway!
Comment #5
wretched sinner - saved by grace CreditAttribution: wretched sinner - saved by grace commentedWould the best solution to this to use the CCK in Core patch that is in process, and allow input filters to be applied to the title? This would give the best flexibility and reduce confusion for new users. I know when I first started using Drupal that I wondered why some text fields had input filters available and some didn't.
Comment #7
Owen Barton CreditAttribution: Owen Barton commentedYes - assuming that we get to the point where the node title is a regular field then this would be awesome - by default it is 1 line, text-only - but this way it could be altered to use a filter format (even a multiline, wysiwyg editor if you really want!).
Anyway, let's leave this as a placeholder...
Comment #8
Owen Barton CreditAttribution: Owen Barton commentedComment #9
keddy8 CreditAttribution: keddy8 commentedSubscribing...
Comment #10
mdupontSimilar to #82751: Allow some HTML tags in node titles and #167176: ampersand in site title not transformed to HTML leads to invalid html code
Comment #11
sun.core CreditAttribution: sun.core commentedComment #12
mdupontDuplicate of #82751: Allow some HTML tags in node titles. See this issue instead.
Comment #13
apaderno