Search

Not quite ‘troubleshooting’ but didn’t want to put it in General.

I’ve hovered around Symphony for a while without taking the plunge, but a new project has given me the opportunity so fingers crossed. This is my first steps into XSL , and I’ve only really done Frontend Stuff ( bits of drupal and wordpress ) in the past so this feels like the right step for me.

Anyhow! I have spent a bit of time reading the docs and comparing the demo workspace to what I need. I have a question that I hope you guys will be able to answer a hell of alot quicker than I’d be able to on my own.

The site is rather straightforward in principle, it has products, products have a range and a type. Now I need 2 views: Product List view and Product Details view.

Now I’ve created my Products datasource that is filtered by a URL parameter on my products page. /products/product-name.

The product list page (/products) differs massively template wise from the product/product-name page, am I right in thinking that I can have the one page to handle both ‘views’ and toggle between them by checking for the url parameter?

Or would I be best creating 2 pages for each view?

Also to keep the XML lean I thought about having the product name as a required field for the datasource to execute but then, obviously it won’t run on the product list page without the parameter (is that right?)

Sorry if this seems elementary, its the XSL that throws me a bit having never used it before, I’m desperate for the project to go well and hopefully go on to become a useful member of this great community and project.

am I right in thinking that I can have the one page to handle both ‘views’ and toggle between them by checking for the url parameter?

Yep, you got it. Your 1 Page will have a single url-parameter, e.g. product-name. You’ll use this for filtering a ‘product-detail’ datasource.

Also to keep the XML lean I thought about having the product name as a required field for the datasource to execute

Right again! You will have (at least) 2 datasources on the Products page: one for product list, where you will only select the fields needed to build the list (maybe just the name and a teaser description or whatever) then a second products detail datasource. This one will filter by the url parameter, and yes, you’ll want to prevent it from outputting unless that url parameter is present.

The potential inefficiency of this setup is that the products list will get all products even if you are loading a product detail view. You may want this if you are creating a persistant product navigation. If not, I believe you could just add the same filter for the product-list DS as you have for the product-detail DS. This way it will only output the XML for the product you are loading.

am I right in thinking that I can have the one page to handle both ‘views’ and toggle between them by checking for the url parameter?

Yep, you got it. Your 1 Page will have a single url-parameter, e.g. product-name. You’ll use this for filtering a ‘product-detail’ datasource.

You would need two different xsl:templates for this though. You could check if the url parameter has a certain value, and then call the right template.

Thanks Guys,

Think I’ve got my head around it (well this bit!), just reassuring to have a nod that I’m heading down the right path at least, if you’ll humour me I may post back here if I hit another roadblock, but I seem to learn best the hard way so we’ll see :)

if you’ll humour me I may post back here if I hit another roadblock

Please do! If you’re hitting roadblocks, someone else will hit them to, so we love to get those questions(and their answers) up on the forum.

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