Search

Sorry for the title, I don't know a quick way to sum up this question.

I have a DS (Projects) that outputs system-id. I filter my chained DS (Pictures) on Pictures.for-project = Projects.system:id. There are multiple Pictures for each Project.

I would like to pull one Picture per Project - whichever has the lowest order. Is this possible with datasources? I feel like I am missing a piece of the puzzle here... Is there some kind of MIN()/MAX() capability? I'm ok with a custom DS if that's the way to do this sort of thing.

Thanks for reading.

does "paginate results, limiting to 1 entries per page. Return page 1" not does this trick ?

Thanks for your response @moma, the trouble I run into there is that I am trying to show multiple Projects, each with one Picture. Essentially this is a category page with thumbnails. If I limit to only one result, I only get one picture, rather than one per Project.

Do you want the first image associated with each entry or a specific image? You could use position() on the image entry node: entry[position () = 1]/image etc..

This would be an xslt way of doing it.. not sure on DS approach.

Some further reading for you on similar options Forum post

I think this is what the Data Source Multiplier extension provides for. But if you're only dealing with a small number of projects/images, I don't suppose the processing time will be reduced by much by moving the limit from XSLT to the data source/queries.

moonoo2 - wouldn't entry[1] do the same thing?

It certainly would... Tomayto, tomahto ;)

Ahah potato : spud :p

Wow, lots of responses. Thank you all!

The Data Source Multiplier is exactly what I need! Thank you @DavidOliver. It also led me to this useful post which I hadn't seen.

My concern with the XSLT solution, @moonoo2, is the same as the poster's in the thread I linked. Theoretically I shouldn't have more than maybe 6 pictures per project, and I am only planning to show pictures for 4, so if I set my limit to 20 I would theoretically always pull at least one image for each project, but it is dicey. Sure I could set my limit higher, but it would be hard to decide where it should be.

^ Just trying to point out where you can get away with writing less code is all :)

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