Creating A Main Page

by Darren Collins
Sunday, 18 November 2001

A list of recently added articles is easy to add to the main page. It's just a foreach loop that lists all articles in descending date order. I also add an upper limit to the number of articles listed (usually 10). This is what my home page's Recent Additions code looks like in the Article window in Normal View:

Main Page Loop

Notice how you can add elements (such as a horizontal rule) inside the loop and change the formatting of each of the lines of text. I find I often need to jump to HTML view (the button at the bottom of the Article window) to get things just right. Below is the HTML View of the same part of my home page:

<P><STRONG>Recent Additions</STRONG></P>
{$foreach 10 x in (all) 
SortDescendBy .fileddate$}
<P class=fileddate>{$x.fileddate$}</P>
<P class=description>{$x.teaser$}
<A href="{$$}">Read on</A>...</P> {$next$}

Observant readers will notice that I use Cascading Style Sheets (CSS) to format the look of the fileddate line and the teaser paragraph. I'll be adding an article on how to use CSS with CityDesk shortly.


Related Articles
- Handy Variables
- Design Test Page
- CityDesk Beta 2.0.1 First Impressions
- Boxed Content
- Managing Content Fragments
- CityDesk Short Tips
- Template Mockups
- Creating A Main Page
- Index Pages
- Using Folders
- Committee Intranet Site
- Migrating to CityDesk
- CityDesk First Impressions
- CityDesk Links

This site Copyright 1999-2005 Darren Collins.