Fix EZP-22748: Treemenu: Cannot modify header information

 - headers already sent

https://jira.ez.no/browse/EZP-22748