Search

On my site, I have two different kinds of content: Articles and Blog Posts. Since I need to list both kinds in a combined, chronological list, both types are in the same section, with a select box defining which kind it is.

But this section is quickly becoming rather crowded, and for usability when working with the content I would prefer to split it in two, one for the Articles and on for the Blog Posts. Simple enough, if it wasn’t for the combined, chronological list.

Is there a way to have a DS fetch content from two different sections at once? Or is this something that will be possible with 2.1’s revised data sources?

/Anders

You could just have two datasources that pull from each of the sections and then in your XSLT combine the two.

Something pseudo like:

<xsl:template match='articles/entry | blogs/entry' mode='entries'>
    <xsl:sort select='date' order='descending' />
</xsl:template>

Yes. But that makes pagination impossible, right?

I don’t think so… Can’t you set each datasource to say, 10 articles each, output 1 pagination element, then when a user clicks on page 2 link, it refreshes both datasources to page 2?

I still have to play with pagination yet, but I asked some questions here about it… Doug’s answer may help, if both datasources use the same p url param, it should work as I stated above (I think). Good Luck!

I’m not sure it would work as I can see a number of problems.

For example, how would you count the total number of pages? I guess you could force it to count the longest one but you’d still run into an issue if they weren’t the same because if you grab 10 from each DS for each page you’re eventually going to hit pages where instead of 20 you get 10, that’s assuming you don’t just get a DS error that locks up your page.

Is this something a dynamic datasource might be good for? You could create template XML page that combined the two (or more) datasources and then reimport that page as a new data source with pagination.

I’ve never tried it but it’s worth a shot?

It’s my thought that if one of the datasources didn’t have the required number of articles to create say page 7, then it would just error in the xml, yet the other datasource wouldn’t. I’m going to play with this when I get home…

You’ll have to request all articles from both Sections (set your DS to 99999) and do the pagination in the XSLT. The only alternative would be a 100% custom DS with a Query pulling and joining (actually, unifying in this case) the sections.

In situations where I’ve tried pulling all entries (usually anything over 500) I usually get an error saying I’ve excited my allocated memory usage.

Is this just something with my host or would I be doing something wrong?

Memory limits are different depending on your hosting plan and/or configuration. You might be able to change them in your .htaccess file — actually I do this rather often when I have to import large amounts of data (like 13,000 entries equalling 60,000 lines of XML — I managed to get this import working with a custom PHP script sending “slices” to Symphony, each with 100 entries).

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