Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » Limit number of pages loaded in Admin

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 576 Views
  • BuddhaSource
    Community Member
    57 Posts

    Limit number of pages loaded in Admin Link to this post


    We just migrated a Word Press news portal to SilverStripe. It has around 3-4k posts. Now this become really difficult to manage in admin section. When you login all 4k posts are loaded. Extremely slow

    Can somebody suggest how can I load only last few post in admin and mark rest of them as Archive or something?

    Here is my code to NewsPost.php

    * Defines the Newspost page type

    class NewsPost extends BlogEntry {
       static $db = array (
    'GalleryImageWidth' => 'Int',
    'Featured' => 'Boolean',
    'UserPost' => 'Boolean',
       static $default_parent = 'NewsHolder';
       static $can_be_root = false;
       static $has_one = array(
          'Photo' => 'Image'

          //'Gallery' => 'ImageGalleryPage'
          //'GalleryImages' => 'GalleryImage'
       static $has_many = array (
    'GalleryImages' => 'GalleryImage'

    public function init() {

    // Note: you should use SS template require tags inside your templates
    // instead of putting Requirements calls here. However these are
    // included so that our older themes still work


       function getCMSFields() {
       $fields = parent::getCMSFields();
    $fields->addFieldsToTab("Root.Content.Main", new CheckboxField('UserPost', "Post by a Member"));
       $fields->addFieldToTab("Root.Content.Main", new CheckboxField('Featured', "Featured Post"));
       $fields->addFieldToTab("Root.Content.Images", $leadImage= new ImageField('Photo', "Upload your lead image here"));
          $leadImage->setFolderName('Uploads/' .date("Y").'/' .date("m"));
       $fields->addFieldToTab("Root.Content.Configuration", $myField= new NumericField('GalleryImageWidth', 'Image Width'));
          /*$fields-> addFieldToTab ("Root.Content.Gallery", new DropdownField("GalleryID", "Gallery",
             DataObject::get("ImageGalleryPage")->toDropdownMap(), 'Content'));*/
          $manager = new ImageDataObjectManager(
    $this, // Controller
    'GalleryImages', // Source name
    'GalleryImage', // Source class
    'MyGalleryImage', // File name on DataObject
    'GalleryImageTitle' => 'GalleryImageTitle'
    ), // Headings
    'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
    // Filter clause
    // Sort clause
    // Join clause

    $fields->addFieldToTab('Root.Content.GalleryImage', $manager);
    return $fields;

    // Function for SideBar
    function GetSidebarContent($num=3) {

    //$randomNumber =
    $sidebarContent = DataObject::get_one("SidebarContent");

    return false;

    $contents = array();

    $contents[] = DBField::create('Varchar', $sidebarContent->Content1);
    $contents[] = DBField::create('Varchar', $sidebarContent->Content2);
    $contents[] = DBField::create('Varchar', $sidebarContent->Content3);
    $contents[] = DBField::create('Varchar', $sidebarContent->Content4);
    $contents[] = DBField::create('Varchar', $sidebarContent->Content5);


    //return new DataObjectSet(array_rand($contents, $num));
    return new DataObjectSet(array_slice($contents, 0, $num));
    //return new DataObjectSet($contents);


    class NewsPost_Controller extends BlogEntry_Controller{


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.