Jump to:

5540 Posts in 1738 Topics by 1224 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: 1713 Views
  • wuzzi2ya
    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)

    <div id="headStrong" class="Newstypography">
       <h2>LATEST NEWS</h2>
       <h3>WHATS HAPPENING AT AKL</h3>   
    <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 %>

    HomPage.php: located in mysite/code/HomPage.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" >

          <% base_tag %>
          <title><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> &raquo; Your Site Name</title>
          <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);
          <!--[if IE 7]>
             <style type="text/css">
              @import url(themes/blackcandy/css/ie7.css);
    <div id="BgContainer">
       <div id="Container">
          <div id="Header">
          <!--<div id="searchForm">$SearchForm</div>-->
          <div id="Navigation">
             <% include Navigation %>
          <div class="flash">
          <div class="copyHome">
          <div id="Layout">
       <div id="Footer">
          <% include Footer %>


    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.

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.