Search

So I have a section of videos that I am categorising with a series of categories using a select box link.. all good.

I have a page with 2 url params: "category/title"

I can filter on one or the other.. i.e if I take one out so it only says "category" and filter my DS on this.. all is well and I get the desired results of only those entries that are related to that category are shown.

But... some videos have no categories and when I click on the link that has a "title/@handle" in the URL, it draws a blank entry as the Category param has no match to the video titles handle.

Is there a way to filter the DS in an "Either, OR, or BOTH" URL parameters at all? I kinda need both approaches so having "category/title" as URL params is essential I think.

Any thoughts would be greatly appreciated.

The best approach imo would be to rework the category/title URL and create 2 pages e.g.:

  • video-categories with category parameter => video-categories/category
  • video-title with title parameter => video-title/title

I just did this but i had to give up the pretty url schema, i submit a form to the page and use the created $url-variables in my data source as the filter. I used 4 fields to have 4 filter possibilities

so you would have video-categories/?category=&title=

and the created variables in symphony that you would sort with are url-category and url-title

Wouldn't one page with two DSs do the trick? Page param of filter and filter categories in one DS, and titles in the other.

It will only return results if the value of filter exists in either DS. That way you can also display whether the video is categorised or titled.

This approach may mean you need three DSs in total for the page though, category filtered, title filtered and a list DS.

@jeffleeder,@VladG - both valid and achievable solutions, but I'm not a fan of the GET approach for this purpose.. and getting client to create a new page and include all relevant DSs in the page isn't really an option. good to know though.

@designermonkey Oooh now there's a thought! I think I'll have a stab at that today. BRB :)

If you get it working, I can show you a nifty trick to null the list DS if the filter parameter exists, which will save you overhead.

One thing at a time though ;o)

heh heh..is it something like {$filter:null} in the DS?

@designermonkey, so If my videos DS has a filter called {$filter} on categories and title and a page URL param of filter.. is that right so far? or Do I need 2 separate DSs ? i.e video1 and video2 DSs..

How can I target parent page in XSLT?

The parent page is in param pool: /data/params/parrent-path.

But I need it multilingual.

@moonoo2

Page LHandles extension ;) it provides a DS that outputs current page and related parents in needed languages.

Yep using that.. just figured the /data/plh-page/page would be the parent and /data/plh-page/page/page is the child of a 1 level deep. unless you know of a slicker way? which I'm guessing you do :)

Well, this is off topic so I'll post back on PLH thread.

Agreed.

Andrew, I posted a similar question a while back and got pointed to this thread on how you can edit your DS so it won't execute unless a particular URL param is set. (This might be the nifty trick John mentioned in #7, not sure.)

@designermonkey, I'm lost mate.. would you happen to have 5 mins to walk through how the DSs would be setup? I have a DS called videos and a filter called {$filter} filtering on Title. But not sure how the other DS would fit into my XML and allow me to have the same results on the same section.. i.e no duplicates of videos

Sorry, been a little busy today.

I can only explain this without multilingual methods, as I've not done them myself, but I'm sure it's not too difficult to modify.

How to...

Datasource (<videos-list>)

Filter Category by {$filter-one}

Datasource (<videos-single>)

Filter Title by {$filter-two:$filter-one}

Required parameter $filter-one

Limit to 1 result.

Output parameter ($ds-videos-single) set to system:id

Customise the <videos-list> datasource to include the following

if(!empty($this->_env['env']['pool']['ds-videos-single'])) return $this->emptyXMLSet();

just before the try statement.

What this allows you to do is filter your page listed videos by category, and if a title is supplied, it will trigger the secondary ds to show any videos that match either $filter-one or $filter-two. This will in turn cancel the first datasource, saving in overhead, as you have your video and don't need a list anymore. Because of the filter setup in the secondary datasource, it will try and filter on either parameter, and will only activate if there is something provided in $filter-one.

In your XSLT you will need to do a switch on the availability of $ds-videos-single to apply the template for a video list, or a single video.

@designermonkey, your a star mate! gonna have a bash tonight at getting this nailed.. one thought, I have the list of videos on right hand side in a sort of jcarousel that filters in the Category and then the single video DS is called into the main part of the page.. do you see any issues having both on the same page using the above method?

See attached image for how the DS and page is currently setup. Video List Page image

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