Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
id in category list
It would be nice if category_list
also offered an id
attribute. For example, instead of
<ul id="menu">
<txp:category_list break="li" wraptag="" />
</ul>
we could have
<txp:category_list break="li" wraptag="ul" id="menu" />
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: id in category list
That might confuse people with Textpattern’s internal IDs though.
Offline
Re: id in category list
what if we call it wrapid?
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 2015-04-14 07:57:33
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: id in category list
Offline
Re: id in category list
That would work, please raise a GitHub issue for this.
Offline
Re: id in category list
On the surface it’s a 2-line patch, and makes sense. But what would you have the attribute do if wraptag
was omitted? Ignore it?
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
Re: id in category list
Bloke wrote #289975:
On the surface it’s a 2-line patch, and makes sense. But what would you have the attribute do if
wraptag
was omitted? Ignore it?
For backward compatibility, yes, I would ignore it. Also should this be implemented for the section_list
tag too?
philwareham wrote #289974:
That would work, please raise a GitHub issue for this.
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: id in category list
colak wrote #289979:
Also should this be implemented for the
section_list
tag too?
as well as for each of ~30 tags having wraptag? I would go the opposite way: reduce the number of built-in HTML attributes and append them at your will:
<txp:etc_query data='<txp:category_list break="li" wraptag="ul" />'
replace="ul@@id=menu@role=navigation" />
or even with <txp:else />
if need:
<txp:etc_query data='<txp:category_list break="li" wraptag="ul" />'
replace="ul@@id=menu@role=navigation"
>
{ul}
<txp:else />
nada
</txp:etc_query>
Offline
Re: id in category list
etc wrote #289980:
as well as for each of ~30 tags having “wraptag”
Yeah, I know what you mean. I’ve tentatively done it anyway the way colak suggested because it saves unnecessary markup and means extra conditionals or plugins are not required to detect those situations where you want to entirely omit the markup if there’s no list content (unlikely for section_list, but possible for category_list).
But I’m not altogether comfortable with attribute bloat like this, and the whole ‘conditional attribute’ thing (attributes that are ignored depending on other attributes) is not ideal to make clear in documentation.
Edit: While a built-in etc_query-style solution for adding attributes would certainly cut down on attributes, the syntax isn’t exactly end-user friendly so if we were to go that route, we’d need something simpler that could add arbitrary atts to any <tag>
(HTML or Txp). Suggestions welcome.
Last edited by Bloke (2015-04-14 09:46:00)
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
Re: id in category list
Hi Stef and Oleg
I might be wrong here but isn’t the nav role="navigation"
usually wrapping the ul
?
so we would have something like
<nav role="navigation" class="myclass" id="myid">
<txp:section_list wraptag="ul" break="li" html_id="menu" />
</nav>
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: id in category list
colak wrote #289983:
isn’t the
nav role="navigation"
usually wrapping theul
?
Normally yes, unless you decide not to use unordered lists, for whatever reason:
<txp:category_list wraptag="nav" break="div" />
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
Re: id in category list
Bloke wrote #289984:
Normally yes, unless you decide not to use unordered lists, for whatever reason:
<txp:category_list wraptag="nav" break="div" />...
I can not think of one but point made:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline