22 November 2009

Step 3. Grab the Data

Data sources fetch and organize content from the system and deliver to pages. We'll need to create one in order to display your greetings on the Home page. Navigate to Blueprints > Data Sources and click the green Create New button.

This is the data source editor. In the Essentials section, let's give our data source an obvious Name: Greetings. Under Source, the Greetings section will be pre-selected, since it's the only one we've created. Let's leave the Filter Results and Sorting and Limiting sections alone for now. The default values will do just fine. You'll learn a bit more about these options in the follow-up to this tutorial. Here, the only other thing we need to do is tell our data source what we need it to output. Under XML Output, in the Included Elements select box, click greeting-text. That's the only field we added to our section, so it's the only one we need to return. Leave the rest of the values in this section at their default. Your form should look like Figure 1:

Hello World: Data Source Creation

Click "Create Data Source".

Now we need to attach our data source to the Home page. Navigate to Blueprints > Pages and click "Home". In the Page Resources section of your home page's configuration, you'll now see your new data source listed in the Data Sources field (Figure 2). Click to select it, and then click the Save Changes button.

We're going to use Symphony's awesome debug devkit to make sure our data's made it through to the front end. It comes packaged with Symphony by default, so all you've got to do is enable it. Navigate to System > Extensions, click the "Debug Devkit" row to select it, choose "Install/Enable" from the With Selected menu at the bottom right of the table, and hit "Apply". Now open a new browser tab and point it to your front end, but add ?debug to the end of the URL. You should see something like Figure 3:

Hello World: Check DS Output

Our Greetings entries have made it through to the front end. Now all we've got to do is whip up a quick template to display them.

Step 4. Build the Template →

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