Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-02-17 20:54:25

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

How can I get links displayed calling their IDs?

How can I get links displayed calling their IDs?
TNX

Offline

#2 2017-02-18 03:43:44

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: How can I get links displayed calling their IDs?

<txp:link id="integer" />

see Link

Offline

#3 2017-02-18 10:20:25

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: How can I get links displayed calling their IDs?

Many thanks.
Is there, also, any way to get the link_url displayed on its ID basis?
I’ve tried this but it doesn’t work:

<a rel=“external” class=“sample” href=”<txp:link_url id=“3549” />”><txp:link_name id=“3549” /></a>

Offline

#4 2017-02-18 10:44:55

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How can I get links displayed calling their IDs?

<txp:php>echo safe_field('url', 'txp_link', 'id=3549');</txp:php>

Offline

#5 2017-02-18 10:52:01

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: How can I get links displayed calling their IDs?

Ok, thanks!
For my case, I’ve just found, also this can be good:

<i><txp:link rel=“external” id=“3549” /></i>

Offline

#6 2017-02-26 08:06:13

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: How can I get links displayed calling their IDs?

What still lack to me is an efficient way to manage the “rel” attribute from outside the article. I’ve found only this:

<span class=“italic”><txp:link rel=’<txp:output_form form=“rel” />’ id=“3549” />.</span>

Offline

#7 2017-02-26 08:22:49

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: How can I get links displayed calling their IDs?

What is it exactly you are trying to achieve? A link list or just links in pages? If it is a link list there maybe some solutions here.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2017-02-26 09:02:35

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: How can I get links displayed calling their IDs?

I need to automate some links inside articles.

Offline

#9 2017-02-26 10:18:29

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: How can I get links displayed calling their IDs?

Bongo-man wrote #304262:

What still lack to me is an efficient way to manage the “rel” attribute from outside the article. I’ve found only this:

<span class=“italic”><txp:link rel=’<txp:output_form form=“rel” />’ id=“3549” />.</span>

Maybe an easy way could be to create a macro using Stef’s Swiss army knife.

This would be a good opportunity to ask the devs to add another field in the links just for the rel attribute. The field could have a pull down with all the valid attributes and it could be “filled” every time a link is created. If no selection is made, the rel does not show . in this way existing installs could keep on working seamlessly.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#10 2017-02-26 19:12:32

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: How can I get links displayed calling their IDs?

Bongo-man wrote #304262:

What still lack to me is an efficient way to manage the “rel” attribute from outside the article. I’ve found only this:

<span class=“italic”><txp:link rel=’<txp:output_form form=“rel” />’ id=“3549” />.</span>

Bongo-man wrote #304265:

I need to automate some links inside articles.

What is in your form called rel, and what are you trying to do with it? Aside from rel="external", I can’t think of many kinds of rel values you might need for a link list.

Is perhaps txp:linklist what you’re looking for? If you just want to include a link list in an article, you could do this:

  • Create a link category for the link list you want to show. Assign that category to your links.
  • Create a form for how your links should be output setting the rel attribute how you want it in your markup, for example:
<a rel="external" href="<txp:link_url />">
    <txp:link_name />
</a>

In your article body, insert:

 <txp:linklist category="my-link-category" form="my-link-form" wraptag="ul" break="li" />

adding a space at the beginning of the line. Your link list should appear automatically.

If you are using categories for some other purpose and just want to include a certain selection of link ids, you should be able to do:

 <txp:linklist id="12,13,14,18,27" form="my-link-form" />

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB