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


Reply

9 Posts   1743 Views

Avatar
wuzzi2ya

10 May 2010 at 7:08am Community Member, 7 Posts

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.