Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Today 14:30:52

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,523
Bitbucket GitHub

How can I show a link's sort value?

I’m scratching my head on this one – is it possible to output a link’s sort value, please?

Last edited by gaekwad (Today 14:31:02)

Offline

#2 Today 15:13:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,010
Website GitHub

Re: How can I show a link's sort value?

Not from the link tags, sadly. Not sure why we don’t have a <txp:link_info /> tag instead of all the useless specific ones, but this should be sidesteppable in 5.0.0 owing to content type retooling and CFs.

In the meantime (untested):

<txp:linklist>
   <link::url />
   ...
   <txp:php>
      global $thislink;
      echo $thislink['linksort'];
   </txp:php>
</txp:linklist>

EDIT: for bonus marks you could set that PHP block up as a shortcode and call your Form linksort. Then you can invoke it with <txp::linksort /> which is at least a bit more friendly – as long as you’re careful to only use it in a link context (otherwise it’ll error out unless you wrap some defensive code around it).

Last edited by Bloke (Today 15:15:22)


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

#3 Today 19:50:23

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

Re: How can I show a link's sort value?

Unless you have etc_query installed :-)

<etc::query globals="thislink" data="{?linksort}" />

Offline

Board footer

Powered by FluxBB