0

I'm in the process of taking things out of our codebase and into content where they belong, things like navigation and listings of categories. I really enjoy the features offered up by the Low Reorder add-on. I use Draggable to manage the order of categories within a category group, but I would only need a subset of these categories.

E.g. given a category group of:

  • Alpha
  • Beta
  • Carrot
  • Doc
  • Elephant
  • Mouse

I may just want 3 of those in a custom order in one place, 4 of them in a different order in another, but all I'd need are the category names, url_titles, and in the desired sequence. Don't need entries. Just the categories.

I might just go ahead and make a channel just for entries with 1:1 relation to categories (maybe along with a WB Category Select field as the relation) and then use Low Reorder to create subsets as desired. But I really want to avoid having to essentially enter content twice and any overhead of channel:entries when all I really need is a list of category names and url_titles. I suppose a bonus would be getting to using the entry title over the category name as an option or something.

I could add custom fields to the category group(s), but then you wouldn't be looking at the set in front of you.

Before I set off to do this I figured I might as well ask the community if there is anything like Low Reorder just for categories? Or if there's an existing module, add-on, or method to do this that slip passed me?

Thanks.

1

I wound up using Taxonomy v3.

I was thinking of going the "easy" route of just using existing channels and using Low Reorder in a somewhat ad-hoc basis... but a few things occurred to me which I was neglecting:

  • {exp:channel:entries} is expensive. Better to avoid it.
  • Every time I add a new entry it would still be added to a set which is made worse if there are multiple sets to a channel.

All I really needed was a way to make simple, customizable lists that preferably tied directly to categories and/or entries. Tying things to categories doesn't seem to exist, so perhaps a way to match url_titles and mentioning the category group id somewhere.

Going through devot-ee I narrowed my options down to NavEE and Taxonomy. NavEE is really simple and looks like it'd help get the job done, but for $10 more Taxonomy offers further customization via custom fields. I kind of dislike having to refer to trees via their id as opposed to some kind of text reference as it's just easier code-wise between development and other versions of a site... but it's got enough features for my needs.

To simulate a list of categories I make a new tree and add custom links where the link is the category's url_title. If needed I can add a custom field to mention which group the category is in. The "tricky" part is that using the {exp:taxonomy:nav display_root="no"} tag results in outputting To avoid an unordered list e.g. <ul>...loop thru nodes...</ul> use style="linear" (haven't tried this yet, hat tip to @iain urquhart).

To work around it hypothetically you could use stash's list methods. I didn't spend a whole lot of time on it but I couldn't get {exp:stash:set_list} to work if it was wrapping it, but perhaps append_list inside of it would work. What I ended up using was either surgeree's strip_tags method or stash get's strip_tags parameter.

To get actual category data I use Cat2, I have my own fork that I can get custom field stuff. ...should have probably added a way to get the images, too...

In the end the one caveat that comes to mind is that if you change an url_title of a category, you'd have to change this everywhere you have used it manually. May want to refer to the category's id instead of url_title if that is an issue.

Now if I could just learn to cache instances of taxonomy and its results... and just cache in general... but that's another topic.

| improve this answer | |
  • 1
    Hey, you can use style="linear" in taxonomy:nav to prevent the list HTML/wrappers being output, that allows you to use whatever HTML you want. – Iain Urquhart May 14 '14 at 8:11
  • @IainUrquhart Don't have time to try this just yet but added it to the answer anyway. Thank you! – notacouch May 14 '14 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.