I just learned, that the $Top scope of an template isn't available within includes, because the $Top scope is set to the current scope of the including template. This can be looked up here:
https://github.com/silverstripe/silverstripe-framework/issues/3460
In the docs this behaviour is described as follows:
"Includes can't directly access the parent scope"
http://doc.silverstripe.org/framework/en/reference/templates
Because I thought this is quite mistakable, I wrote a comment clarifying this in the help pages. And as I think it is quite normal to need the "original" $Top scope within includes I posted a little workaround for this:
MainTemplate: <% include NestedTemplate MainController=$Top %>
NestedTemplate: <% include NestedTemplate MainController=$MainController %>
But my comment didn't last 10 minutes before it disappeared. I don't know if it has been deleted or if there's another reason why it is not available anymore. I didn't get any feedback.
Therefor some questions:
- Why my comment did disappear?
- When it has been deleted: Why? And why I got no feedback / response?
- Is something wrong with my workaround, because of which it should not appear on the help pages? And if: Would it not be better to inform the author about such mistakes and not only deleting the comment? Or to correct it answering the comment so others can learn from it?