Ditto - 2. How to Display a List of Articles

From MODx Wiki
Jump to: navigation, search

How to Display a List of Articles

This an example of how to create your website and add a blog or list of news items using Ditto.

1. The first step is to create your content

  • We will have 4 pages- Home, About Us, Contact Us, and Blog
  • Create a new article for each page.
  • Leave the content for Blog blank

2. Right-click on the Blog page (in the tree) and choose 'Create document here'

  • Name it Blog 1 and put some example text in the content.
  • Do this 2 more times for a total of 3 articles in the Blog folder

3. Create your Blog template

  • Create a new chunk called 'tpl_Blog'
  • Paste the following code into it
  <h3><a href="[~[+id+]~]">[+date+] : [+title+] </a></h3>
  <p>[+content+]</p>

4. Put Ditto in the Blog parent Article

  • Edit the page titled Blog and enter the following information
  [[Ditto? &parents=`THE_ID_OF_THE_BLOG_GOES_HERE` &tpl=`tpl_Blog` ]]

That is it for creating a simple blog. There are many additional parameters you can use to customize Ditto. In the next few articles, we will look at eForm and Wayfinder.

Personal tools