Search

Hi.

I'm finishing a project and it has the following structure:
/works (list of all the works, only the title and image)
/works/name-of-work (like a blog post with all the information)

I created a data source by following the example of the Article workspace that comes in the installation but when creating a page that would be the post, it puts a handle getting /works/work/...

How to do this part? I need two data sources for a list and another to pull only one entry right? What about the Page vs. URL how do you not have more one handle?

So you need the Work page set up with a URL Parameter work. So when you view /work/my-project-handle it still loads the Work page, rather than a 404.

You can re-use the same data source for your list of projects as well as getting a single project. In your data source, filter your Title by {$work}, which refers to the URL Parameter you created above. When you view the page without a URL Parameter (just /work/) then all entries will be returned because the filter has no value, and so is ignored. But when you view a single project (/work/my-project-handle/) then just the one project will be returned. In your XSLT you can use an xsl:choose condition to test for the value of $work and show either a list, or a single project.

There are two small problems with this approach however:

The first is that your data source will need all fields selected in the Included Elements list, for when you view a single project. When you get the list of all projects and you only really need the title and image, all other fields will still be in the XML, which is a bit wasteful.

Secondly, when you view a single project, you data source will return one entry only, and so you cannot use this data source to build a list of "other projects" in your navigation (should you wish to do so).

Therefore the best solution is probably to use two data sources on the page. One will get all project entries and just include the title and image, and will not filter anything. The second will filter on the project title and will include all fields, but you can add $work into the Required URL Parameter box, to make sure this data source only executes when the URL Parameter has a value.

Hope all of that makes sense.

Concepts:

Hi Nick, thank you very much. I'm trying do it now. =)

Hi Nick, I think that I'm on right way.
I have some doubts:

1) On the list url debug have all thing (2 datasources, full), where I can select only the 1 datasource (listing) for this url?
/nossas-obras/

2) If I add the $work (variable) on Required URL Parameter when access the /nossas-obras/
Return 404, so without the required I can access the listing.

3) On post url like
/nossas-obras/edificio-comercial-grande-vista/?debug
I can see perfect the "post" data full and listing, without full another "posts" but, need implement yet the choose to change the view.

See some screens of my configuration if need.

Attachments:
Symphony – Data Sources – Obras (Todas)_1300469205956.png, Symphony – Data Sources – Obra_1300469193637.png and Symphony – Components_1300469181008.png

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