Search

Hi everyone, I'm working on my first real project with symphony although I've been around the forum for a while.

The website I'm building is like a news site, with 4-5 different sections updated with different frequency. I'd like to begin with the right foot and make a nice and celan DS, since I need to retrive quite a lot of information from the database.

For every section I'd like to fetch the latest post as well as its first paragraph. I would also like to be able to display only the title of some other 5 articles. Since it's a multilingual site, for every title and body there is also a translation… I'm afraid it's a lot of work and I was wondering if building a data source for every section is the right approach. It will be 5 DSs, each fetching 6 articles with 2 titles and 2 bodies (full?) each. Could it be a little to much?

What do you guys think? Is there a better approach?

Thank you very much, Giulio

I'm afraid that for 5 sections You will need 5 data sources.

Does every section use the same fields? If each of them has title, body and photos field, then maybe it would be better to create just one section, with additional "category" field? You would still need 5 data sources to get 6 articles for each of categories/sections tough. Unless You use some hack, like assuming that in first 100 entries there will be at least 6 entries for each category, in which case You can use one data source and group it's output by category.

http://symphony21.com/forum/discussions/781/1/

I had the same question. I guess there's no way to do this without coding your own DS or pulling a lot of data you don't need.

MrBlank I saw your question but still no answer. It's strange that something like this didn't came up before (or at least I couldn't find it)

ahwayakchih I also thought to make a big fat data source but I guess that it would be even worse. Which is more demanding to the server, the queries or the xslt manipulation required to take the data out? (or something else I'm missing) Tomorrow I'll do some testing and I'll let you know.

iltrico it probably depends on hardware, server load and database location. There is big chance that with localhost database it is faster to do few simple queries than one with big output, because Symphony first loops through selected data and builds array, then turns that array into XML, and then XSLT starts. Probably building XML is most time consuming (it uses a lot of function calls) of those 3, and may make large data set slow. Not to mention that there is no guarantee that big fat data source will return at least 6 entries for each of categories.

MrBlank is right, coding own data source may be most optimal solution. It's not that hard to do, unless You don't know PHP at all :).

iltrico, I think you can make one section for all your articles and put a category in through a selectbox (link). Then, use one datasource to grab the last x entries. If you want to display some posts from several categories and get different data from different posts, you have to create different datasources anyway.

It will be 10 DSs in total, 5 of them fetching 5 articles with 2 titles and 5 of them fetching 1 article with 2 titles and 2 bodies (full?) each.

However, this is not so bad. I am including 20+ datasources in one page and it still functions okay. As long as you limit the size of your datasources, I guess you are fine.

Here some early tests with just 3 categories on localhost, so there might be some bais.

3 different DSs each fetching 5 complete articles:

  • Total Database Queries: 271
  • Total Time Spent on Queries: 0.0236 s
  • XML Generation Function: 0.0026 s
  • XSLT Generation: 0.0072 s
  • Output Creation Time: 0.1475 s

1 Big Fat DS fetching all 15 complete articles (of course I'll need many more to be sure to get at least 5 entries for every section):

  • Total Database Queries: 259
  • Total Time Spent on Queries: 0.0199 s
  • XML Generation Function: 0.0025 s
  • XSLT Generation: 0.0083 s
  • Output Creation Time: 0.1359 s

At this level seems that many DSs are a better and more precise solution. Later I want to try carsten's solution which on paper is more optimized.

Does anyone have any experience to share or any comment on this small test?

iltrico, thanks!

It's strange that 1 big DS took more queries than 3 small DSes. Maybe some fields fetch additional data.

It would be interesting to see if Your 1st plan (5 DSes, each fetching 6 entries with titles and bodies) is faster or slower than Carsten's idea to use 10 data sources.

ahwayakchih, you are right, I forgot the DS that gets the sections' names. Edited the original post

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