Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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

#3 2005-06-19 10:26:25

Etz Haim
Archived Plugin Author
From: Karlstad, Sweden
Registered: 2005-01-24
Posts: 262
Website

Re: URL-only title

This mod should make its way into the official distro, IMO.

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

#5 2005-07-29 08:13:09

Garfield
Member
From: Barcelona
Registered: 2005-07-09
Posts: 11
Website

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

#6 2005-07-29 10:33:17

kemie
Plugin Author
From: mexico<-->sweden
Registered: 2004-05-20
Posts: 495
Website

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

#8 2005-07-29 19:00:10

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

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

#9 2005-12-16 03:15:50

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#10 2006-11-29 23:23:20

mwillse
Member
From: brooklyn, ny
Registered: 2006-06-26
Posts: 83
Website

Re: URL-only title

It would be usefull to access url-only title for css…

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

#15 2007-03-20 09:08:29

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

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

Board footer

Powered by FluxBB