Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-05-20 18:36:44

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

Links in 4.7

Up to now, the links tab was accepting values without a link in the URL field. A method which assisted us in generating lists but also to use the tab in more creative ways.

Now the info is not saving unless a link is entered. Is there a way to bring back the old functionality, where the URL field was not compulsory?


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

Offline

#2 2018-05-21 04:57:01

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

Re: Links in 4.7

Dunno, potentially it leads to <a /> tags without href attribute, which are kinda invalid. You can just put # as URL, perhaps?

Offline

#3 2018-05-21 05:12:54

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

Re: Links in 4.7

Hi Oleg,

Maybe I should supply some sample code I am using here

<txp:linklist category="contributors" limit="999999" sort="linksort" break=" &bull; " wraptag="p">
<txp:variable name="haslink" value='<txp:link_url />' /> 
<txp:if_variable name="haslink" value=""> 
<txp:link_name escape="" /> 
<txp:else /> 
<a class="ext" href="<txp:link_url />" rel="external"><txp:link_name escape="html" /></a> 
</txp:if_variable> 
</txp:linklist>

and here

<txp:act_if_mobile>
<p>A random selection from the 16 videos from the conference. Refresh your browser to view others</p>
<txp:linklist category="ttrrandvid" limit="6" sort="rand()" form="videos" wraptag="div" class="slider" />
</txp:act_if_mobile>

and the form

<iframe src="https://player.vimeo.com/video/<txp:link_description escape="" />?title=0&amp;byline=0&amp;portrait=0" allowfullscreen></iframe>

Currently I am actually using # which I then delete in phpMyAdmin.


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

Offline

#4 2018-05-21 06:23:02

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

Re: Links in 4.7

I guess I could change my code to make it work as intended.

<txp:linklist category="contributors" limit="999999" sort="linksort" break=" &bull; " wraptag="p">
<txp:variable name="haslink" value='<txp:link_url />' /> 
<txp:if_variable name="haslink" value="#"> 
<txp:link_name escape="" /> 
<txp:else /> 
<a class="ext" href="<txp:link_url />" rel="external"><txp:link_name escape="html" /></a> 
</txp:if_variable> 
</txp:linklist>

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

Offline

#5 2018-05-22 10:54:13

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

Re: Links in 4.7

I’m fine with making URL optional, what the others think?

Offline

#6 2018-05-22 11:06:17

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

Re: Links in 4.7

Sure, optional’s good. If it makes it more flexible for esoteric uses, the worst that can happen is generating a blank anchor, which is up to the designer anyway.

EDIT: Having said that, I can’t see any overarching use cases to make it optional. Yiannis’ code with the ‘#’ works equally well. It’s whether we see the link content type as fundamental enough to warrant enforcing the destination. I mean, that’s what the Link type is for… right? If you’re not using links to generate links, what do people use them for?

Last edited by Bloke (2018-05-22 11:09:08)


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 2018-05-22 11:15:06

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Links in 4.7

Bloke wrote #311966:

that’s what the Link type is for… right? If you’re not using links to generate links, what do people use them for?

I agree with this. Making it optional is a bit counter to what the expected functionality would be, I think. Esoteric uses are probably very rare, and as long as they can be done by another way, then why leave it ‘weird’. ;)

Then again, I have no real position either way.

Offline

#8 2018-05-22 11:43:35

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

Re: Links in 4.7

Bloke wrote #311966:

I can’t see any overarching use cases to make it optional. Yiannis’ code with the ‘#’ works equally well.

That’s what I thought too, but it’s an old (if not the oldest!) txp site, so Yiannis would need to treat two cases. And the use of # is rather esoteric anyway.

If you’re not using links to generate links, what do people use them for?

Actually, href-less links are HTML5-valid (href could be set via, say, JS). Why would we force people into “traditional” way?

Offline

#9 2018-05-22 11:58:42

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

Re: Links in 4.7

etc wrote #311973:

Actually, href-less links are HTML5-valid (href could be set via, say, JS).

In that case, making them optional is fine by me.


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 2018-05-22 12:45:00

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

Re: Links in 4.7

Bloke wrote #311966:

If you’re not using links to generate links, what do people use them for?

I use the tab in a number of ways not all of which are to generate links. Two methods, I explain above. The # method nevertheless works for me so no worries if you decide to keep it as it is.


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

Offline

#11 2018-05-22 13:26:29

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

Re: Links in 4.7

Bloke wrote #311975:

In that case, making them optional is fine by me.

Done, since it’s backward-compatible too.

Offline

Board footer

Powered by FluxBB