Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Problem with SiteTree structure loading


Go to End


8 Posts   3326 Views

Avatar
jezikk

Community Member, 10 Posts

11 January 2009 at 7:04am

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

11 January 2009 at 6:01pm

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

Avatar
jezikk

Community Member, 10 Posts

11 January 2009 at 11:16pm

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 ?

Avatar
Fuzz10

Community Member, 791 Posts

13 January 2009 at 11:02pm

Damn.... That sucks..

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

DIO ! ?????

Avatar
dio5

Community Member, 501 Posts

13 January 2009 at 11:11pm

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.

Avatar
jezikk

Community Member, 10 Posts

13 January 2009 at 11:28pm

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.

Avatar
dio5

Community Member, 501 Posts

13 January 2009 at 11:36pm

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

Avatar
jezikk

Community Member, 10 Posts

13 January 2009 at 11:44pm

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