Search

Hello,

I bet I have seen a discussion on this question in the forum months ago but I cannot find it anymore. Sorry if my question has been answered before.

On a page listing architectural projects I am using a parameter "category" for building category. Each project is assigned to a category via a selectbox link. Projects are only given one category. I can call the page for example like this

projects/housing

projects/offices

I would like to be able to open the page with the parameter set to "all" and the page should then show all projects:

projects/all

I would not like to create a category called "all" and assign all projects to it.

Is this possible? Thanks for your help?

when I don't use these both page options and just ad no paramteters to the page; the whole datasource is included in my xml.

Output Options Required URL Parameter Optional

An empty result will be returned when this parameter does not have a value. Redirect to 404 page when no results are found

There might be some more elegant way than this one I describe, but my two cents for having the all parameter on board:

I would create two separate datasources (DS), one returning all projects (lets say Projects: All), and one filtered by the category (let it be Projects - this one would be the one you are currently using).

Next I would add Conditionalizer to condition the execution of those two DS like:

for Projects: All

(if value of ({$category}) is (all))

for Projects

(if value of ({$category}) is not (all))

And as for XSLT, I would join the transformation with something like:

<xsl:apply-templates select="/data/projects/entry | /data/projects-all/entry" mode="project"/>
...
<xsl:template match="entry" mode="project">
...

Suit your XML paths. Not sure about the XSLT performance of this, but I guess it can be rewritten more efficiently if needed.

I wrote this just from scratch, sorry for some possible inaccuracy.

I think you could create a page called all with parent projects and move all your page xsl into a utility that you include.

I think you could create a page ...

Yep, definitely the most elegant way :)

Hi Moritz,

either go with a dedicated subpage the way Patrick suggested or - if the "all" in the URL isn't of real importance to you - just leave it out and set up your datasource-param-filter like that:

{$category:0}

That way your URL projects/ will return all projects, no matter which category they are assigned to.

Hope that helps & happy new year to you, Roman

Thanks to all three of you. In some cases I already used your idea, moma. In this case the parameter in question is not the last one and thus I needed a trick – your idea, juro, works wonderfully.

Happy new year, Roman, and to all of you!

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