Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2005-06-18 18:59:46
- alexwest
- Member
- From: Järna, Sweden
- Registered: 2004-08-04
- Posts: 53
URL-only title
Is there any tag or plugin to disply the content of the “URL-only title” field of an article?
Thx
be safe and happy
Offline
#2 2005-06-18 21:18:33
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: URL-only title
If you add this
<code>
function url_title($atts)
{
global $thisarticle;
return $thisarticle[‘url_title’];
}
</code>
<br />to taghandlers.php, you’ve got a tag <code><txp:url_title /></code>.
<br />[Edit] You can also make it into a plugin, if you don’t want to have to modify that file every time you upgrade.
Last edited by doggiez (2005-06-18 21:20:32)
Offline
Re: URL-only title
This mod should make its way into the official distro, IMO.
VC3 :: weblog :: my wishlist
Offline
#4 2005-07-27 17:57:09
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: URL-only title
What’s the use for this?
(This is an honest question, not a… challenge?)
Offline
Re: URL-only title
I think the same as Etz, indeed I think that a “feature” to be added would be the ability to use/access any individual field of the articles/links/files …
http://forum.textpattern.com/viewtopic.php?id=9836
thanks.
Offline
Re: URL-only title
mary, i used this a bit ago to create my own permlinks (needed to append an anchor to the end of the link)
~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~
Offline
#7 2005-07-29 12:05:51
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: URL-only title
<txp:permlink /> should return the complete permlink URL only, without the link tags. Something like <a href="<txp:permlink />#foo">.. might do what you want.
Alex
Offline
Re: URL-only title
Assuming that returns the full URL, http:// and all, I’d still lobby for the ability to just pull out the URL-title. It’d be handy for tag-related things like Tagback or the related reading format I’ve been working on.
You cooin’ with my bird?
Offline
Re: URL-only title
What’s the use for this?
(This is an honest question, not a… challenge?)
I think this can be useful to add class/id to body/divs/etc and apply special CSS to a particular individual article.
Something like:
<body id="<txp:section />" class="<txp:url_title />">
That will output
<body id="articles" class="my-article-url">
And then add some specific rules in the CSS.
Offline
Offline
#11 2007-01-07 01:16:42
- jawtab
- New Member
- Registered: 2007-01-07
- Posts: 5
Re: URL-only title
I just tried this and followed the directions and added the code to the taghandlers.php in the include directory but am getting nothing.
Does this work in the latest version 4.04?
thanks in advance
Offline
#12 2007-01-07 02:46:57
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: URL-only title
It might help if you told us what you’re trying to do.
Last edited by Mary (2007-01-07 23:25:48)
Offline
#13 2007-01-07 12:03:16
- Ace of Dubs
- Member

- Registered: 2006-04-17
- Posts: 446
Re: URL-only title
Mary,
I agree with the others that this should be a standard tag in the core.
I find this indispensible not only for neat CSS tricks but also when I need to add class hooks for javascript stuff on the fly..
<h2 class=”<txp:url-title />”><txp:title /></h2>
<p class=”<txp:url-title />”>Text that is toggled by clicking on the title.</p>
Up till now I been using TXP globals with PHP like so…
<txp:php>echo $GLOBALS[‘thisarticle’][‘url_title’];</txp:php>
But from now on I will just use the hack propsed by Els
Offline
#14 2007-01-07 23:28:10
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: URL-only title
jawtab: Ignore my previous post if you read it, for some reason I was thinking yours was the first post in a separate thread.
Ace: it already was added, to crockery.
Offline
Re: URL-only title
Els wrote:
If you add this
<code>
function url_title($atts)
{
global $thisarticle;
return $thisarticle[‘url_title’];
}
</code>
to taghandlers.php, you’ve got a tag <code><txp:url_title /></code>.
[Edit] You can also make it into a plugin, if you don’t want to have to modify that file every time you upgrade.
This is a really useful hack for me – especially when building custom URLs in sections, but I just tried it in 4.04 for the first time and Els’ warning was well-founded… seems it doesn’t work with this version. Does anyone know how to fix it?
many thanks
Stu
Offline