Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-04-14 03:22:25

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,193
Website

RFE: url attribute for the txp:author

Currently it appears not straight-forward to display the URL for an author page in plain text (e.g http://example.com/author/Julius+Nemo).
So far the best I could come up with is:

http://example.com<txp:page_url />

I could’t really use <txp:site_url /> here as it generates http://example.com/ (ending ‘/’) while <txp:page_url /> generates something like /author/Julius+Nemo (note opening ‘/’) – one ends up with a double slash after the domain; not a big problem, most servers will happily resolve the url correctly, but it doesn’t look pretty…

So here is my wish: have an ‘url’ attribute (boolean, off by default) for the <txp:author /> tag, similar to the one that exist for <txp:category />. My use case, fwiw, is adding the page URL to printed pages (I know, browsers usually do that somehow, but regularly truncated).


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#2 2015-04-14 07:05:04

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: RFE: url attribute for the txp:author

I think this is already in 4.6?

Offline

#3 2015-04-14 07:23:20

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,193
Website

Re: RFE: url attribute for the txp:author

Hmm, not working here. I am testing with the admin-layout branch though. Was there a recent change on the main branch that I missed?


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#4 2015-04-14 08:15:39

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: RFE: url attribute for the txp:author

Hmmm, maybe it wasn’t then! Please raise an issue in GitHub for this.

Offline

#5 2015-04-14 08:52:49

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,193
Website

Re: RFE: url attribute for the txp:author

Done: issue471


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#6 2015-04-14 08:56:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: RFE: url attribute for the txp:author


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2015-04-14 09:00:49

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,193
Website

Re: RFE: url attribute for the txp:author

Bloke wrote #289977:

Done

So fast, so fast …

Thanks!


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#8 2015-04-16 08:24:56

etc
Developer
Registered: 2010-11-11
Posts: 5,192
Website GitHub

Re: RFE: url attribute for the txp:author

Out of curiosity: why is it so tricky to output the full current page URL? It’s required quite often, for example to style active menu items. Something like <txp:page_url type="full" /> could be useful in this and other situations.

Offline

#9 2015-04-16 10:54:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: RFE: url attribute for the txp:author

etc wrote #290021:

Out of curiosity: why is it so tricky to output the full current page URL?

Shouldn’t be tough. We already have type="request_uri" which is the full URL including query string so it ought to be easy to lop it off.

Presumably there’s a $_SERVER variable we can rely on? If so, it’s a two-line fix: care to put forward a pull request? Or let me know which method you favour / send a patch and I’ll do it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2015-04-16 11:04:01

etc
Developer
Registered: 2010-11-11
Posts: 5,192
Website GitHub

Re: RFE: url attribute for the txp:author

Bloke wrote #290029:

Presumably there’s a $_SERVER variable we can rely on? If so, it’s a two-line fix: care to put forward a pull request? Or let me know which method you favour / send a patch and I’ll do it.

That’s my very question: what is the most natural/reliable method? $_SERVER, or hu, or something else? wish I knew before pulling…

Offline

#11 2015-04-16 11:30:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: RFE: url attribute for the txp:author

etc wrote #290030:

what is the most natural/reliable method? $_SERVER, or hu, or something else?

hu only returns the site’s domain so the remainder would need building up based on Section and so forth, which wouldn’t cater for error pages and custom plugin URLs and stuff.

For that reason alone I guess something from $_SERVER would be preferable, as long as it can be relied upon not to be spoofed. Worst case scenario we can use the same as whatever we use to get type="request_uri" and just str_replace() / substr() / regex off the query string portion.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2015-04-16 19:55:18

etc
Developer
Registered: 2010-11-11
Posts: 5,192
Website GitHub

Re: RFE: url attribute for the txp:author

For applications (link highlighting, etc) I’d rather prefer some “canonical” form, as produced by permlinkurl() and pagelinkurl(). But this means more than two-line fix, unfortunately.

Offline

Board footer

Powered by FluxBB