In a plugin, what function could I call to determine whether a document is considered a folder?
For example, blog.html may show up as an html page, it is considered a folder by the system because it contains my blog posts.
-
☆ A M B ☆
- 24,524 Posts
$modx->documentObject[’isfolder’] will be 1.
It’s worthwhile to browse through the site_content table in the database to see what the documentObject array will have.
removed as susan types faster than I do... :}
I am using 0.9.5 beta latest build. I think this might have been removed in this version because it only returns ’null’ even when im in a folder. Any ideas?
Heres what I’m using in a plugin to test
if($this->documentObject[’isfolder’] == 1)
{ echo("Blah");
}else
{ echo("Die");
}
-
MODX Staff
- 10,725 Posts
Try, $modx->documentObject -- $this has no meaning in the scope of a plugin which is eval()’d.
-
☆ A M B ☆
- 24,524 Posts
Hm. I’m not sure that the documentObject array is available at that point in the parser. If that’s the case, you’ll need to check the database directly.
One of the core developers will probably know more about what’s available at that point, though.
-
MODX Staff
- 10,725 Posts
That’s correct, the documentObject is built after OnWebPageInit, and before OnLoadWebDocument.