I have this class:
class adminTemplate { public static function load() { return new self(); } public function sidebarGuide() { return 'content'; // Very long html markup } public function wrapSidebars($content) { ob_start(); echo "<div class='sidebar wrapper'>"; echo $content; echo "</div>"; $output = ob_get_contents(); ob_end_clean(); return $output; } // Other methods here } Somewhere in my script, I have to call wrapSidebars using sidebarGuide's output as parameter:
echo adminTemplate::load()->wrapSidebars(myClassadminTemplate::load()->sidebarGuide()); It works, but I'm pretty confident there is a more appropriate way.
- Is there a proper way of passing methods'output as other method's parameter in a class loaded "statically"?
- Besides that, is there a more elegant code structure to accomplish the same "task"?