CityScript

 

How Do I Make A What's New List?

Web sites often have a "What's New" list on their main page, showing all recently-added articles. There are two general approaches I've used to do this - showing the 10 most recent pages, or showing all pages added in the last month.

Listing The 10 Most Recent Articles

If you'd like more or less articles listed, change the '10' in the first line to the desired number.

<ul>{$ foreach 10 x in (all) SortDescendBy .fileddate $}
<li><a href="{$x.link$}">{$x.headline$}</a></li>
{$next$}</ul>

Listing All Articles Added In The Past Month

If you'd like to list articles for a different time period (e.g. past two weeks, or past three months), change the '31' in the first line to the number of days back you'd like your list to go.

<ul>{$ foreach x in (after publishdate-31) SortDescendBy .fileddate $}
<li><a href="{$x.link$}">{$x.headline$}</a></li>
{$next$}</ul>

Back to Top

How Do I Get The Date Of My Last Update?

It's nice to be able to specify somewhere on your home page the date of the last update of your site. Here's an easy way to do this.

Create a new variable, named lastUpdate (or whatever you'd prefer). Inside that variable, include this text:

{$setDateTimeFormat "English" "ddd,  d MMM yyyy" "hh:mm:ss"$}
{$foreach 1 z in all sortDescendBy .modifiedDate$}
{$z.modifiedDate$} {$z.modifiedTime$}
{$next$}

Of course, you can change the date/time format to whatever suits.

Wherever you want to insert the time of last update, you can now use the {$.lastUpdate$} variable.

For example, the CityDesk FAQ was last updated: Tue, 16 May 2006 01:24:18

Back to Top