Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Different Content Region

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

Page: 1
Go to End
Author Topic: 434 Views
  • Ryan Lawrence
    Avatar
    Community Member
    8 Posts

    Different Content Region Link to this post

    Hello,
    I have this script in mysite/code/home.php

    <?php
    /**
    * Defines the HomePage page type
    */

    class Home extends Page {
       
    static $db = array (
    'Comingsoon' => Text
    );
    function getCMSFields()
    {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Content.Main", new TextAreaField ('Comingsoon','Content'));
    return $fields;
    }

    static $has_one = array(
    );
    }

    class Home_Controller extends Page_Controller {
       

    function LatestBlogEntry($num=3) {
    $blogpost = DataObject::get_one("BlogHolder");
    return ($blogpost) ? DataObject::get("BlogEntry", "", "Date DESC", "", $num) : false;
    }
    }

    What I am basically trying to do is have a different content region on my homepage what is editable in the CMS. I have called it Comingsoon. All I have done is home.php above and just added a $Comingsoon to my template. This isn't working, I dunno if I have missed a step or the code is just wrong. Please help. (Ignore the blog bit at the bottom)
    Thanks Ryan

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Different Content Region Link to this post

    Should work... Did you /?flush=1 to refresh the template?

    434 Views
Page: 1
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.