Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-06-28 13:27:53

hevling
New Member
Registered: 2013-06-28
Posts: 1

articles, links, photos in 1 list

Hi,

I’m newbie within the Textpattern CMS.
Is it possible to show all articles, links, … actually each content element within 1 single list/overview chronological?

Kind regards,

Offline

#2 2013-06-28 14:17:36

etc
Developer
Registered: 2010-11-11
Posts: 5,397
Website GitHub

Re: articles, links, photos in 1 list

Hi hevling, welcome to the forum!

I don’t think it’s possible natively, because they have too different structure, but you have at least two plugin solution:

  • either query db tables (textpattern, txp_link, ...) directly with smd_query or etc_query;
  • or use appropriately crafted <txp:article_custom />, <txp:linklist />, … tags, and then merge the lists with etc_query.

You can also do it client-side in javascript. Just shout if you need help.

Offline

#3 2013-06-28 20:34:35

etc
Developer
Registered: 2010-11-11
Posts: 5,397
Website GitHub

Re: articles, links, photos in 1 list

Here is how you can merge articles and files in one list sorted by date, if XSL extension is enabled on your server:

<txp:variable name="mix">
	<dl>
	<txp:article_custom>
		<dt><txp:posted format="%Y-%m-%d" /></dt>
		<dd><txp:title /></dd>
	</txp:article_custom>
	<txp:file_download_list>
		<dt><txp:file_download_modified format="%Y-%m-%d" /></dt>
		<dd><txp:file_download_name /></dd>
	</txp:file_download_list>
	</dl>
</txp:variable>

<txp:etc_query data='<txp:variable name="mix" />'>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" />
<xsl:template match="dl">
	<dl>
	<xsl:for-each select="dt">
	<xsl:sort select="." order="descending" />
		<xsl:copy-of select="." />
		<xsl:copy-of select="following-sibling::dd[1]" />
	</xsl:for-each>
	</dl>
</xsl:template>
</xsl:stylesheet>
</txp:etc_query>

Offline

Board footer

Powered by FluxBB