Adding a Page of Articles
Speck includes a fairly generic Article content type, which we'll use in this section to add a page of news articles to the hello speck application. If you haven't already run through the process of creating the hello speck application, now might be a good time.
ColdFusion Template
Create a new file called news.cfm in the www directory containing the content below.
news.cfm
<cfoutput>
<html>
<head>
<title>Speck News</title>
</head>
<body>
<h2>Speck News</h2>
</cfoutput>
<cfif isDefined("url.spId")>
<cf_spContent type="Article" id="#url.spId#">
<cfelse>
<cf_spContent type="Article" keywords="news" method="summary">
</cfif>
<cfoutput>
</body>
</html>
</cfoutput>
Did you notice that the method attribute seems to be missing from the call to cf_spContent that retrieves and ouptuts an article? We can do this because the default value for the method attribute is "display".
In Speck, all content types are effectively specializations of the default content type, which has a display method. You really should override the display method when creating a new content type though, because the default display method just cfdumps the content.
Now, open the news page at http://localhost/news.cfm and make sure the "Admin Links" box is checked. If you don't see the toolbar, you'll need to log in again at http://localhost/speck/login.cfm?app=hellospeck and then open the news page.
Click on the link to add a new article. A new window will open, similar to the one used to add a Blurb content item to the home page, but with a few more fields. Add a title, summary and some content, then save your changes and close the window.
Your new article will appear on the news page, but just the title and summary are shown, with a link to read the full article. Click through to the full article and you'll see there is also a print friendly version available. Admittedly, it does all look like muck at the moment, but we haven't started styling anything yet and the template contains just a few lines of CFML!