cancel
Showing results for 
Search instead for 
Did you mean: 

Creating News Page for Intranet Portal

tvo1003
Champ in-the-making
Champ in-the-making
Hello! I am new to this Alfresco WCM platform and am trying to make a news page on an intranet portal.

So far I have created a schema, which defines a form for news content input. Then, a template is used to generate the XML files. The XML files are generated with a filename consisting of the date and time, so that they are sorted in chronological order in my directory.

What are my options for creating a home page that always shows the 3 latest news articles? What language(s) would I use to implement this?

Help is very much appreciated, thank you!
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
You have a couple of options. You could use an XSLT or Freemarker template to build the list of the three latest news items. You'd add an additional template to your existing form that outputs a file with a consistent name, say index.html, and that would have the three latest news items. Honestly, I haven't tried this in a while, so I'm not sure it is the preferred method.

Alternatively, you could write a web script that would query the repository for the three latest news items. A web script is written with server-side JavaScript and Freemarker. The server-side JavaScript can use the AVM API to find nodes in your web project. You could then have your front-end, written in whatever language you are comfortable with, invoke the web script over HTTP. The web script would return the latest news items in a format of your choosing–HTML, JSON, RSS, or raw XML. Your page could then take that data and style the results.

Refer to Chapter 8 of the Alfresco Developer Guide (Packt) for examples. I haven't read it, but Munwar Shariff's Alfresco 3 Web Content Management (Packt) book may also be of some help.

Jeff

tvo1003
Champ in-the-making
Champ in-the-making
Jeff, thank you for your reply. I have a clearer idea of my options. Could you help me a little more and elaborate on your first paragraph please?

You have a couple of options. You could use an XSLT or Freemarker template to build the list of the three latest news items. You'd add an additional template to your existing form that outputs a file with a consistent name, say index.html, and that would have the three latest news items. Honestly, I haven't tried this in a while, so I'm not sure it is the preferred method.

I have no idea how to use XSLT to build the list of the three latest news items. How do I make this list using XSLT? Does it involve retrieving a list of the folder's contents where the .XML news files are stored? If so, how do you do this? If you could describe the process, that would be great!

Using an XSLT template, I know how to do the latter part of generating the index.html file, but not the step before (making a list of the 3 latest news items).

Alternatively, you could write a web script that would query the repository for the three latest news items. A web script is written with server-side JavaScript and Freemarker. The server-side JavaScript can use the AVM API to find nodes in your web project. You could then have your front-end, written in whatever language you are comfortable with, invoke the web script over HTTP. The web script would return the latest news items in a format of your choosing–HTML, JSON, RSS, or raw XML. Your page could then take that data and style the results.

Refer to Chapter 8 of the Alfresco Developer Guide (Packt) for examples. I haven't read it, but Munwar Shariff's Alfresco 3 Web Content Management (Packt) book may also be of some help.
Jeff

Thank you for the book recommendations Jeff, I will head to the bookstore.