Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2021-08-17 08:46:51

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

Re: Linklist bug?

Ahem… I thought this fairly complicated issue nailed… it is not. Back to old dogs variable then, mea culpa.

Offline

#14 2021-08-20 06:17:21

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

Re: Linklist bug?

A combination of old dog and new code yielded the solution for this one. Posting it here, should anyone have a similar issue.

<txp:variable name="active_links"><txp:linklist category="active" form=""><txp:link_url /></txp:linklist></txp:variable>
<txp:if_variable name="active_links" value="">
<h4>Previous emails</h4>
<txp:linklist category="expired" evaluate="link_description" sort="id desc" wraptag="ul" break="li" labeltag="" label=""  limit="5" form="" trim><txp:link_description />: <a href="<txp:link_url />"><txp:link_name /></a></txp:linklist>
<txp:else />
<txp:linklist category="active" evaluate="link_description" sort="id desc" wraptag="ul" break="li" labeltag="h4" label="Latest emails" limit="10" form="" trim><txp:link_description />: <a href="<txp:link_url />"><txp:link_name /></a></txp:linklist>
<txp:linklist category="expired" evaluate="link_description" sort="id desc" wraptag="ul" break="li" labeltag="h4" label="Previous emails"  limit="5" form="" trim><txp:link_description />: <a href="<txp:link_url />"><txp:link_name /></a></txp:linklist>
</txp:if_variable>

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

Offline

#15 2021-08-20 08:11:33

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

Re: Linklist bug?

colak wrote #331432:

A combination of old dog and new code yielded the solution for this one.

Hmm, maybe yes, maybe no. If you have a chance to try your old new code on 4.8.8, please let me know if it works.

Offline

#16 2021-08-20 08:18:09

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

Re: Linklist bug?

Another thing to keep in mind when using evaluate in lists with limit is that you can get no output even when there are some valid items. It works like this:

  • limit number of items are retrieved from db;
  • each is tested by evaluate;
  • the items that do not pass the test are eliminated.

So you generally get les than limit items in the resulting list.

Edit: to be sure you get all valid links in your case, you can try sort="description='', id DESC".

Offline

#17 2021-08-20 08:31:45

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

Re: Linklist bug?

etc wrote #331434:

Another thing to keep in mind when using evaluate in lists with limit is that you can get no output even when there are some valid items. It works like this:

  • limit number of items are retrieved from db;
  • each is tested by evaluate;
  • the items that do not pass the test are eliminated.

So you generally get les than limit items in the resulting list.

Hi Oleg, It’s good to know. Thankfully, I am in charge of the list and all links are OK, even with the limit. In fact I use the evaluate tag to help me identify my errors. In this case, it is my posting of links without a description.


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

Offline

#18 2021-08-20 08:38:26

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

Re: Linklist bug?

Hi Yiannis, I just can not reproduce your issue on 4.8.8, whence the request.

Offline

#19 2021-08-20 08:51:43

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

Re: Linklist bug?

Admittedly, I cannot reproduce it on the demo site either. It may be something in my setup which I could not figure out. I did correct the code above by removing the limit from the variable just to be on the safe side. I think you have access to my site, all you need is to access the latest modified article, should you wish to confirm if there is actually a bug.


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

Offline

Board footer

Powered by FluxBB