Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Articles(news) in sidebar

Go to End

3 Posts   2537 Views


6 Posts

22 November 2007 at 2:27pm


First of all I'm loving this cms, the creators have done a very good job in ss.

I would like to know if it is possible to have articles in the homepage in a two columns layout. For example have the latest 3 articles in a right column and the $Content in the left column.

It is possible to achieve this?
Thanks for your help.


Forum Moderator, 5521 Posts

24 November 2007 at 3:53pm

This is pretty simple to do. This is covered in the 2nd tutorial so you might want to read that . Basically you need to do 2 things. I am going to assume you have your holder/news page types the same as Tutorial 2.

So step 1 Make the function that gets the latest news. Add this to the class Page_controller in Page.php.

function LatestNews() {
  $news = DataObject::get("ArticlePage", "", "Date DESC", "", 3) ;
  return ($news) ? $news : false;

One that you have that function you need to output the news list on the website. So you need to add some code like this to where ever you want to out put the latest news -

<ul id="NewsList">
  <% control LatestNews %>
    <li><a href="$Link" title="Read more on &quot;{$Title}&quot;">$Title</a></li>
  <% end_control %>


6 Posts

26 November 2007 at 2:28pm

Hi willr,

Thanks, it works like a charm. I should have read the tutorials whith more attention.