Articles tagged with custom-data-source

How to Display Next and Previous Article Links in Symphony CMS 2

When a single content entry is displayed on a web page it is often desired that links be provided to the next and previous chronological entries. (This can apply to any content with a date field, not just articles.) This article attempts to explain how this can be done using a single custom data source. It is difficult (impossible?) to do this using only the backend data source creator.

The following assumptions are made in the remainder of this article:

Read the full article.

How to Create a Tag Cloud Using a Custom Data Source

I promised to follow up a previous article with a few examples like this one. If you haven't already, and you are new to custom data sources, you should read that article before reading this one. This is provided as an example only; it is not necessarily the best way to implement a tag cloud.

If your site content includes a section with a Tag List field (zero, one, or more words or phrases separated by commas) you might want to display the tags along with their frequency of use. One way to do that is to just list the tags along with a count of all the section entries that contain the tags. Another is to list the tags without the count but set the font size in proportion to the frequency of use. I use the latter method, called a tag cloud, on my archives page. Either way you will need to extract from your database a list of all the tags used and a count of the entries that contain the tags.

Read the full article.

How to Create a Custom Data Source in Symphony CMS 2

In Symphony a data source is the conduit between your content, which is stored in a database, and the web page you display to site visitors. It allows you to extract data from specified tables and to filter, sort and group that data before displaying it. Although Symphony offers considerable flexibility in defining data sources in the Symphony backend, you most likely will encounter situations where you would like to do a little more than Symphony offers.

A data source pulls from only one section. (A section defines a type of content, the fields that are used to collect the content and the data base tables where the content is stored. There is a one-to-one correspondence between fields and tables.) But suppose the content you want to display from one section depends on the content of another section, and suppose the dependency is more complex than a simple link, like linking comments to articles or articles to categories. A custom data source is one way to do this. You might be able to use two data sources to pull all the content from both sections and then do the merging with XSLT, but this could involve a lot of processing overhead, depending on the size of the content and the nature of the dependency between the sections.

Read the full article.