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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

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

Latest blogs\news\articles


Go to End


2 Posts   1563 Views

Avatar
Rcls

Community Member, 2 Posts

31 January 2011 at 4:08am

Edited: 31/01/2011 4:09am

I didn't get any replies during a period of one week in the other section so I might as well ask here since the News and Blogs are basically the same code.

I'm not the most skilled coder, but I created a website for a client. I wanted to test out SilverStripe and though it has some annoying little things, like having to upload files on the FTP to get pages or styles to update, or flushing cache every 5 minutes, it works great.

I downloaded and installed an extension named News. Basically it's the same NewsHolder (ArticleHolder) and NewsPage (ArticlePage) to what is in the tutorials but without having to create the files yourself. It works great, you can view results here: http://www.ossipesonen.fi/www/ss_cms/uutiset/
But I have a problem. I can't get the "Tiedotteet" or Latest News to show on every page. It only shows on the News page. How can I change this? Latests News is like Latests Blogs but even in the tutorials it only works on HomePage. Do I need to change to a different CMS to get this working?

Page.ss

<% include Menu2 %>

Menu2.ss

<% control Menu(2) %>
   <% if Children %>
    <li><p style="padding-top: 10px;"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela">$MenuTitle.XML</a></p>
   <% else %>
      <li><p style="padding-top: 10px;"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela">$MenuTitle.XML</a></p>
   <% end_if %>   
</li>
<% end_control %>   

Avatar
Willr

Forum Moderator, 5523 Posts

31 January 2011 at 1:19pm

Latests News is like Latests Blogs but even in the tutorials it only works on HomePage.

This is because the PHP function is stored in the HomePage class (HomePage.php). No other page types "know" about functionality contained in other classes. If you want the same LatestNews() function available on all pages you should put the PHP function that is in HomePage.php (LatestNews()) in Page.php instead. All pages on your site should extend off Page so they will all inherit this functionality.