Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
Re: RFE: url attribute for the txp:author
I think this is already in 4.6?
Offline
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
Re: RFE: url attribute for the txp:author
Hmmm, maybe it wasn’t then! Please raise an issue in GitHub for this.
Offline
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
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
Re: RFE: url attribute for the txp:author
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
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
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
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
Re: RFE: url attribute for the txp:author
etc wrote #290030:
what is the most natural/reliable method?
$_SERVER
, orhu
, 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
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