Jump to:

22996 Posts in 11844 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Problem with SiteTree structure loading

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1862 Views
  • jezikk
    Avatar
    Community Member
    10 Posts

    Problem with SiteTree structure loading Link to this post

    Hi All,

    I'm new in SS development, however I get some futures to work. Now I have a huge problem with SiteTree.
    In CMS Admin I have a page tree like this:
    HomePage -> News ->
    >2008 -> (~500 news)
    >2007 -> (~200 news)

    Problem with this is as follow:
    1. Very load admin UI loading time (~2minutes)
    2. Expand of NEWS folder takes ~3-4 min, during this process ale sub-content is loaded (every news form folder 2008 and 2007) and it is not used.
    3. Expand of eg NEWS - >2008 folder loads the same information as previously, and it takes another 2-3 min.

    PROBLEM is defined as the SS loads recursively all the content is sitetree.

    So I want to find a way to block recursive content loading.
    I found the file Hierarchy.php located in sappire/core/model directory in which is a function getChildrenAsUL. This function return the content as UL/LI recursive list for sitetree.

    Can anybody help mi how to modify this (or any other function) to block recursive loading ?
    I use SS version 2.2.3

    thx in advance for any help.

    p.s. Maybe You know some better idea who to handle hundreds of pages in one directory.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Problem with SiteTree structure loading Link to this post

    Ahhh... Thank you for calling attention to this. I definitely sympathize with you. I've always said that this is a huge interface flaw in Silverstripe. I can't stand the site tree for this very reason.

    Best thing I can tell you is hack the getChildrenAsUL function. You could probably sniff out the number of children on each iteration, but then again, you're going to need to get them somehow. It would be great if the children loaded asyncrhonously on the site tree.

    Agh.. that sucks, man. I always knew that this would be a real pain point for SS

  • jezikk
    Avatar
    Community Member
    10 Posts

    Re: Problem with SiteTree structure loading Link to this post

    I was trying to hack getChildrenAsUL function by commenting the line 55
    $output .= $child->getChildrenAsUL("", $titleEval, $extraArg, $limitToMarked, false) ;

    However, in this case the is some bug, site tree load only first level items and when i expand second level it's reading this level items BUT for firs 2 directories site tree have wrong class and do not add link + to expand. I've tested it ale it always happened to first 2 dirs, nothing else. Rest is working fine.

    I've tested loading 200 items in one-level loading takes ~25 seconds. Admin loading time was less then 30 seconds.

    Any suggestions ?

  • Fuzz10
    Avatar
    Community Member
    786 Posts

    Re: Problem with SiteTree structure loading Link to this post

    Damn.... That sucks..

    I think Dio played around with a quick-fix for this somewhere in 2008 didn't he ?

    DIO ! ?????

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Problem with SiteTree structure loading Link to this post

    Yes I did, however my solution came down to more or less the same: hacking Hierarchy and playing with stageChildren();

    However, there is a better way: subclassing Hierarchy (for example MyHierarchy), modify stageChildren() and add your subclass to the extensions of your Page class:

    static $extensions = array(
             "MyHierarchy",
             "Translatable('Title', 'MenuTitle', 'Content', 'URLSegment', 'MetaTitle', 'MetaDescription', 'MetaKeywords', 'Status')",
             "Versioned('Stage', 'Live')"
          );

    Hopefully that should give you some hints, haven't really done it myself yet.

  • jezikk
    Avatar
    Community Member
    10 Posts

    Re: Problem with SiteTree structure loading Link to this post

    Thx for reply, unfortunatlly I didnt succed with this problem.

    I was thinking about overwriting Hierarchy by my class, but firstly I wanted to figure out that this will work.
    If anybody have some solution for that problem OR any other idea how to manage with w news in different way.

    E.g. I was thinking and looking for something like pagination (as in assets, reading piece by piece) and creating it as another module.
    For now i think it is the best solution.

    However, in future versions of SS this should be handled in better way.

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Problem with SiteTree structure loading Link to this post

    I agree 100%...

    There was a topic about this quite a while ago, maybe that helps a bit:

    http://www.silverstripe.org/archive/show/15416

  • jezikk
    Avatar
    Community Member
    10 Posts

    Re: Problem with SiteTree structure loading Link to this post

    Thx for the topic,
    I'll take a look on it, maybe I get something interesting.

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