Jump to content

Recommended Posts

Posted

I have an event page were you can select multiple sub-categories with a page field using checkboxes. Now i want to display all the sub-categories but also have them sorted by their parent category. I tried something lik below but that didn't work.

$tags = $event_cat->find("sort=$event_cat->parent");
foreach ($tags as $tag){
	echo $tag;
}

Any ideas?

Posted

Hi Tim,

What is the structure of your tree? I've read your question twice, but can't seem to understand what you mean. You can sort by subfields like:

$pages->find("template=test, sort=parent.title, sort=page_field.sort");

Perhaps that is what you are looking for?

  • Like 1
Posted

And still you where able to answer my question!

sort=parent.title

Is what i was looking for.

  • Like 1
Posted

If your parent categories are siblings you can do this:

$page->my_page_field->sort("parent.sort");

(You can do it anyway even if they're not siblings but the sort might not make much sense in that case.)

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...