The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

About Post #26 (Call to a member function view() on a non-object)

hexa2k9's Avatar


25 Jan, 2012 08:23 PM


as discussed on the Problems-Forum on "Call to a member function view() on a non-object" what's the advantage of using $app = Slim::getInstance() instead of global $app for getting a reference to $app?


  1. Support Staff 1 Posted by Josh Lockhart on 25 Jan, 2012 08:28 PM

    Josh Lockhart's Avatar

    Globals are generally considered a "bad thing". To avoid using globals, Slim maintains a static hash of all named applications so you can reference them with Slim::getInstance('the-name'). However, globals still work so you can certainly use global $app instead.


  2. Josh Lockhart closed this discussion on 25 Jan, 2012 08:28 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac