Search

I know this has been discussed many times, and I don't mean to beat a dead horse here, but I have a rather complicated project that Symphony is perfect for.. aside from the troubles of hierarchy.

I'll try to be brief here, but I need nested categories. Hundreds if not thousands of them. I'd love to use an extension (Nested Categories, Breadcrumb Field), but I also need each entry associated with every category level, which from my experience, isn't possible with either one of them. That, and I still need a URL structure of /parent/child/grand-child/etc.

At the moment, I have four sections, one for each category level I need. Children SBL to Parents, Grand-Children SBL to Children, etc. I know this is messy and asking for trouble, but it's the only way I know of that will keep the url structure and allow me to associate entries with each level.

This works and functions great, but the trouble I'm having now is creating a large nested list of all category entries. Associating entries to their parent via multiple sections is coming off as rather difficult. I'm sure it's possible, I just haven't been able to get it to work yet. That, and you can probably imagine that once thousands of categories are in place, the page load and strain that would cause on the server.. I've only entered a little over 100 of them at this point, and I already see a noticeable drop in load time.

I hate to say it, but I think I either have to sacrifice that essential nested menu, or rethink the system I'm using to build it.. Which kills me, I love working with Symphony and every other part of this project is completely doable. Does anyone possibly have a solution / suggestion to the needs I mentioned above? Am I mistaken and going about this completely wrong?

Thanks ahead of time.

I don't know if this fits what you're looking for, but I created a front end interface for Symphony to deal with multiple levels of navigation for the Cities ensemble.

The URL Parameters look like this (six levels + an action param for create and edit):

continent/country/region/city/guide/article/action

This URL structure is not exposed to the public, but it is used for a custom admin area built as front end pages which are only accessible by a Symphony author.

The admin pages also have a nested structure for managing content (four levels + an action and result params for managing event actions and results):

navigation/section/content/item/action/result

I built this originally with Symphony 2 Beta revision 5, using the deprecated Section Link field. For the Cities ensemble, I have replaced the Section Link field with the Select Box Link field.

So, I'd say that it is quite possible to use Symphony for complex hierarchies, but the problem comes when you want to represent these hierarchies in the Symphony admin area. I created this before the release of version 2.0 specifically to highlight the UI problem in Symphony and how I might solve it by creating a sort of OS X Finder style panels user interface for navigating the hierarchy in a custom front end admin area.

Hi, @XBleed

but I also need each entry associated with every category level

This should definitely work with Nested Categories extension. Download it from Github because zip archive at Symphony's Downloads section may be too old.

So, I've also been playing with this sort of thing, and there isn't a great, memory non-intensive way of doing this (when you have thousands of categories I mean), but I like what I've come up with.

What you need:

Reflection Field

Due to the wonderfulness that is the Reflection Field, I've got a little thing going in a project that requires nested categories in a section, which I have running up to three levels deep ($parent,$child,$grandchild). There's nothing to say it doesn't work deeper though.

I have a Categories section containing the following:

  1. Reflection Field: Called 'Hierarchy' with an expression: {normalize-space(concat(normalize-space(entry/parent),' ',entry/name/@handle))}
  2. Text Input: Called 'Name', Required. (Save the section here.)
  3. Select Box Link: Called 'Parent', selects from this section's Hierarchy field. I've set this to 9999 most recent values, this is where the overhead can come into it.
  4. Display these field's values in the entries table, and the select box link field's relationships.

As the 'Hierarchy' field is the first in the list, the section can be sorted by this field, and you can see all the values too. When you have a Select Box Link in a section that requires a category, set it to show relationships, and you can also see any entries that use categories.

Now comes the great bit, datasource filtering! I'm testing this by having a page that accepts three parameters, parent/child/grandchild. I created a datasource that filters the Categories section, on the Reflection Field, using the following in the filter box:

contains: {$grandchild:$child:$parent}

This will filter the datasource so that when only the parent parameter is input on the frontend, all it's children and grandchildren are displayed, and so on for child etc.

You could even go another level to create specific datasources for each level if you needed, and create more levels if required.

Foreseeable problems

If you wanted to have categories with the same name under different parents, I could see this causing problems with the filtering. This could be avoided by setting a 'Level' select box with a static list of hierarchy levels, I'll have to look into this though. I also would like to see a 'Filtered Select Box Link' field that could use an xPath expression to filter the entries it shows based on the xPath for each entries other values. That would be awesome.

Anyhoo, what are peoples thoughts on this?

@bauhouse .. That is some impressive work! I'm going to download and check it out in just a bit, but it looks like it's very similar to what I'm desiring here.

@andrrr, Interesting! I didn't realize it did this before. I've checked it out again and it does seem to work, however, an issue does show up with the /parent/child/grand-child/etc. URL parameters. Let's say, for example, I have these categories:

Furniture
    Dining Room
        Tables
        Chairs
    Home Office
        Desks
        Filing Cabinets

Let's say I just have one entry, but it's under Furniture > Home Office > Desks

I would need to filter the Nested Category field by all navigation levels, right? So, {$parent}+{$child}+{$grandchild}

But when I tried that, if I accessed the url of: /furniture/dining-room/, the entry would still show up. I imagine this is because it's matching the parent of furniture.

It seems that by killing the desired url structure, and accessing the category by id (as some categories will share the same name/handle) would suffice. The url structure isn't a deal breaker, that's for sure. But if I do end up going that route, I'd still actually need to create a breadcrumb trail on the front-end for the user.. From what I can see, I'm not sure how I'd go about that, as the entry xml doesn't show some sort of path with it?

Very cool @designermonkey. That's great for creating a drilldown type menu. I suppose the issue I would still run into with this approach is associating entries to every level of category?

So if there's an entry in Furniture > Dining Room > Tables, I'd still want that to show up if only the parent or child parameters are specified. I think the contains: filter is only applicable to reflection field types? And entries are only associated to them via SBL.

So far, it seems like my best route is to kill the idea of the URL structure and go with Nested Categories.. Then figure out a way to still create a breadcrumb trail. But I still need to check out @bauhouses ensemble.

Let's say I just have one entry, but it's under Furniture > Home Office >Desks

You can filter by {$any-of-that-three-categories} with same result — you'll get that entry.

accessing the category by id (as some categories will share the same name/handle)

It's not necessary to filter by ID because extension creates unique handles

I'd still actually need to create a breadcrumb trail

It's quite easy to implement using a recursive xsl template and a bit modified Nested Categories DS. I'll post it tomorrow if you wish.

It's quite easy to implement using a recursive xsl template and a bit modified Nested Categories DS. I'll post it tomorrow if you wish.

If you don't mind, that would be awesome! If that's the case, I think this would be the solution and I can still use Symphony to build this site, which is great news. I would be sacrificing the URL structure still, but that's a small price to pay when it also opens the opportunity for categories nested further than just four levels.

@designermonkey

I also would like to see a 'Filtered Select Box Link' field that could use an xPath expression to filter the entries it shows based on the xPath for each entries other values. That would be awesome.

Heh, good one. The filtered version of SBL is implemented for SBL+ in my fork. It doesn't work on xPath, but rather based on another SBL+ that points to parent section. Make sure you check the example in the readme.

@XBleed, update the extension via Git, please. You'll find new Nested Categories Breadcrumbs Data Source after that. Attach it to the page and use category as URL Parameter on that page, or change line 7 at /extensions/nestedcats/data-sources/data.nc_breadcrumbs.php to whatever you need.

And Here is example template which you can use for showing breadcrumb

@andrrr, this is great! Thanks a ton!

I suppose the issue I would still run into with this approach is associating entries to every level of category?

Do you know, I've not got to that bit yet, but the whole idea of this pattern is to achieve exactly that. I'll get back to you ;o)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details