Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Linklist bug?
Bug?
With an empty break attribute, it works fine
<txp:linklist category="textpattern" wraptag="ul" break="" sort="id desc" labeltag="h4" label="txp links" limit="5" form="">
<txp:variable name="has_description"><txp:link_description /></txp:variable>
<txp:if_variable name="has_description" value="">
<txp:else />
<li><txp:link_description />: <a href="<txp:link_url />"><txp:link_name /></a></li>
</txp:if_variable>
</txp:linklist>
With a defined break attribute, we get some additional empty lis
<txp:linklist category="textpattern" wraptag="ul" break="li" sort="id desc" labeltag="h4" label="txp links" limit="5" form="">
<txp:variable name="has_description"><txp:link_description /></txp:variable>
<txp:if_variable name="has_description" value="">
<txp:else />
<txp:link_description />: <a href="<txp:link_url />"><txp:link_name /></a>
</txp:if_variable>
</txp:linklist>
Tested on the latest vanilla release, in an article.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Linklist bug?
colak wrote #331352:
Bug?
Feature :-) Historically, empty items are not removed from the lists (linklist or other). Additionally, in your construction they are never empty, containing few linebreaks even when has_description variable is empty. To fix, try adding trim attribute:
<txp:linklist trim ... />
Offline
Re: Linklist bug?
etc wrote #331353:
Feature :-) Historically, empty items are not removed from the lists (
linklistor other). Additionally, in your construction they are never empty, containing few linebreaks even whenhas_descriptionvariable is empty. To fix, try addingtrimattribute:
<txp:linklist trim ... />...
That does indeed fix the issue!
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Offline
Re: Linklist bug?
Offline
Offline
Re: Linklist bug?
etc wrote #331359:
Me too, though I would go with a boring
<txp:linklist evaluate="link_description" wraptag="ul" break="li" ...>...
the modern way is so much better to my classicist gymnastics!!!
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Offline
Re: Linklist bug?
etc wrote #331369:
Old dogs we are :-)
A very old dog, I have become:)
There still an issue which I can not duplicate on the demo site.
This is what I use in an article.
<txp:linklist category="active" evaluate="link_description" sort="id desc" wraptag="ul" break="li" labeltag="h4" label="Latest emails" limit="20" form=""><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="Past emails" limit="5" form=""><txp:link_description />: <a href="<txp:link_url />"><txp:link_name /></a></txp:linklist>
The output parses everything as expected when there is an entry in the active link category but the label and labeltag are omitted from the expired category when there is no entry in the active category. This is indeed a gremlin for me. (I did check the source too).
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Linklist bug?
colak wrote #331375:
The output parses everything as expected when there is an entry in the
activelink category but the label and labeltag are omitted from theexpiredcategory when there is no entry in theactivecategory. This is indeed a gremlin for me. (I did check the source too).
This is by design, labels are created only when the list is not empty. If you want them unconditionally, prepend them manually.
Offline
Re: Linklist bug?
etc wrote #331369:
Old dogs we are :-)
me too. evaluate is one of those “new” attributes (ahem, it has been there for a little bit) that I keep forgetting at first. Bit is is soooo useful.
Last edited by phiw13 (2021-08-17 00:11:01)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: Linklist bug?
etc wrote #331383:
This is by design, labels are created only when the list is not empty. If you want them unconditionally, prepend them manually.
Maybe I did not explain it correctly. The expired list is never empty but its label and labeltag are omitted when the active list is empty.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline