Jump to:

5450 Posts in 1672 Topics by 1197 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: 1554 Views
  • wuzzi2ya
    Avatar
    Community Member
    7 Posts

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

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

  • bartvanirsel
    Avatar
    Community Member
    88 Posts

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

    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.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

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

    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.

  • wuzzi2ya
    Avatar
    Community Member
    7 Posts

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

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

  • wuzzi2ya
    Avatar
    Community Member
    7 Posts

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

    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?

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

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

    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.

  • bartvanirsel
    Avatar
    Community Member
    88 Posts

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

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

  • wuzzi2ya
    Avatar
    Community Member
    7 Posts

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

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

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