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.

Customising the CMS /

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

Ability to update different page sections within the same page


Go to End


9 Posts   3511 Views

Avatar
wuzzi2ya

Community Member, 7 Posts

10 May 2010 at 7:08am

Apparently I am doing something wrong or not doing something entirely. Here is what I have:

hompage.ss: located in themes/blackcandy/templates/Layout/hompage.ss (I just kept the same name blackcandy yet it has been modified)

$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 LatestNews %>
<li class="newsDateTitle">$Title</li>
<li class="newsDateTitle">$Date.Nice</li>
<li class="newsSummary">$Content.FirstParagraph Read more >></li>
<% end_control %>
</ul>
</div>

HomPage.php: located in mysite/code/HomPage.php

<?php

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

Page.ss located in templates/page.ss

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

<head>
<% base_tag %>
<title><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> &raquo; Your Site Name</title>
$MetaTags(false)
<link rel="shortcut icon" href="/favicon.ico" />

<% require themedCSS(layout) %>
<% require themedCSS(typography) %>
<% require themedCSS(form) %>

<!--[if IE 6]>
<style type="text/css">
@import url(themes/blackcandy/css/ie6.css);
</style>
<![endif]-->

<!--[if IE 7]>
<style type="text/css">
@import url(themes/blackcandy/css/ie7.css);
</style>
<![endif]-->
</head>
<body>
<div id="BgContainer">
<div id="Container">
<div id="Header">
<!--<div id="searchForm">$SearchForm</div>-->

<div id="Navigation">
<% include Navigation %>
</div>

</div>
<div class="flash">

</div>

<div class="copyHome">
<div id="Layout">
$Layout
</div>
<div>

</div>
<div id="Footer">
<% include Footer %>
</div>
</div>

</body>
</html>

I am using ArticleHolder.ss and ArticlePage.ss to display the news articles on a news page, but am not able to get the same thing on the hompage. Is there something else that needs to be done within the admin?

Thanks Again for all the assistance.

Go to Top