Search

Hy all, I'm completely new to symphony, on the search for the best suited CMS for my current project, I stepped on this one and I really love what I read so far. Only the concept of the datasources is not willing to get into my head. I read the (extremely short) tutorial over and over again and now I'm more confused then before. Even if it sound's really stupid:

How do I pass a parameter to a datasource?

Is the concept based on a standart, where I can get further informations from external sources or is it symphony specific?

How can I call a datasource more than once on a page, with different parameters?

Basically I'm trying to build a startpage that aggregates articles from different categories, listing the latest three articles for each category. And, as long as we're on it, how would you implement a hierarchical category, so that it's possible to request all articles of sub-categories when calling a parent-category.

Cheers, Till

in your particular instance, you wouldn't need to pass a parameter to your datasource at all. if you create a datasource called something like articles by category, then in the lower right of the datasource create/edit page, underneath 'XML Output' there is a dropdown box labeled 'group by'. this will structure your xml in such a way that you can select a category and then select the first 3 articles.

Fawx has the right of it for what you're describing on your start page. "Group by" is a really useful little option..

How do I pass a parameter to a datasource?

You set up a filter with the parameter as a value. Suppose later you want to create a page that displays all the articles from a specific category. You can set a url parameter on that page that returns the requested category as $category. Then in your data source, you set up a filter on the Category field, and for the Value you enter {$category}.

How can I call a datasource more than once on a page, with different parameters?

I'm almost certain the answer is "you will never need to." Data sources are designed to return all the data you'll need from that source as XML; you get to decide how the data is displayed when you write your XSLT template. Judicious use of data source filtering and the "group by" option will make sure the XML produced by the data source is what you need for your template.

For example, suppose you have two categories: "Apples" and "Oranges" and you want to display articles from both on the same page (and no articles from any other category). As the data source filters page above explains, the comma acts as a union operator. So for the Value of your category filter, you would write Apples, Oranges and that would filter only articles that belong to "Apples" or "Oranges".

And, as long as we're on it, how would you implement a hierarchical category, so that it's possible to request all articles of sub-categories when calling a parent-category.

I haven't done parent-child relationships like this yet in Symphony, so there's probably someone with more experience who can help you here. It depends on how you have set up the relationship between categories. You will probably be using a data source's output parameter to filter a second data source on that category.

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