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.

Customising the CMS /

Ability to update different page sections within the same page


Go to End
Reply


9 Posts   1899 Views

Avatar
wuzzi2ya

Community Member, 7 Posts

29 April 2010 at 3:32am

I would like to be able to have 3 sections in the body of my homepage each spaced equally and horizontally. The layout is not a problem, what I need assistance with is the ability to update the content in each of the 3 sections independently. For example I have the 1st section far left with a header and small info with a read more. Then a center section with alternate header and info also with a read more. Then the far right section be a news section with header and feeds to news page. How do I go about setting this up in the CMS? Do I just need to create 3 submenus and change the content to not be nav but just copy? Seem as a CMS this shoud be quite easily accomplished. Be gentle Im familiar with CMS yet this is my first SS addition.

Thanks for any and all support...

Avatar
bartvanirsel

Community Member, 94 Posts

29 April 2010 at 7:57am

First i recommend reading the docs at http://doc.silverstripe.org/ and order the book.

For creating different page sections within one page i recommend creating a blocks_holder which you can
use in your site tree. This blocks holder is in the page and can hold blocks with different settings in them.
This way it's posible to re-order your blocks by using the drag and drop functionality.

Avatar
Willr

Forum Moderator, 5513 Posts

29 April 2010 at 11:57pm

1st section far left with a header and small info with a read more

Have a read of the 2nd tutorial. It covers how to add fields to the CMS. I wouldn't create pages just for content but just add a TextField, TextareaField etc to the HomePage using getCMSFields(). Like I said, tutorial 2 is a good start for this.

Avatar
wuzzi2ya

Community Member, 7 Posts

30 April 2010 at 2:16am

Thanks all. I read over the extending-a-basic-site and am implementing the getCMSFields with ArticleHolder. So far so good...

Avatar
wuzzi2ya

Community Member, 7 Posts

6 May 2010 at 5:16pm

Sooo I am getting stuck here:
Cant seem to get the latest news on the homepage. Here is what I have:

HomePage.php within mysite/code
-----------------------------------
<?php

class HomePage extends Page {
function LatestNews($num=3) {
$news = DataObject::get_one("ArticleHolder");
return ($news) ? DataObject::get("ArticlePage", "ParentID = $news->ID", "Date DESC", "", $num) : false;
}
}
?>

Homepage.ss within templates/layout
-----------------------
$Content
<div id="headStrong" class="Newstypography">
<h2>LATEST NEWS</h2>
<h3>WHATS HAPPENING AT AKL</h3>
</div>
<div id="ContentNews" class="typography">
<ul id="NewsList">
<% control Children %>
<li class="newsDateTitle">$Title</li>
<li class="newsDateTitle">$Date.Nice</li>
<li class="newsSummary">$Content.FirstParagraph Read more >></li>
<% end_control %>
</ul>
</div>

When this is all uploaded nothing shows on the homepage. What am I not doing or doing wrong?

Avatar
Willr

Forum Moderator, 5513 Posts

6 May 2010 at 6:13pm

If you want to get the Latest news from that LatestNews function then you need to use <% control LatestNews %> not control Children in your template.

Avatar
bartvanirsel

Community Member, 94 Posts

6 May 2010 at 7:17pm

i also think the LatestNews method should be in the controller to make it work.

Avatar
wuzzi2ya

Community Member, 7 Posts

7 May 2010 at 2:38am

Well that makes perfect sense... I wont be able to get back to this project until later tonight, so I will put in the fix then. Thanks all...

Just to be clear, replace:
<% control Children %>
<li class="newsDateTitle">$Title</li>
<li class="newsDateTitle">$Date.Nice</li>
<li class="newsSummary">$Content.FirstParagraph Read more >></li>
<% end_control %>

with:
<% control LatestNews %>
<li class="newsDateTitle">$Title</li>
<li class="newsDateTitle">$Date.Nice</li>
<li class="newsSummary">$Content.FirstParagraph Read more >></li>
<% end_control %>

Thanks again, great forum...

Go to Top