Jump to:

5514 Posts in 1733 Topics by 1219 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Ability to update different page sections within the same page

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

Page: 1 2
Go to End
Author Topic: 1683 Views
  • wuzzi2ya
    Avatar
    Community Member
    7 Posts

    Re: Ability to update different page sections within the same page Link to this post

    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" 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.

    1683 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.