I found many code snippets in Magento such as
$variable_name = Mage::app()->function_name();
here’s an example
$websites = Mage::app()->getWebsites(true, true);
What does this function call (calls?) do? The syntax is unfamiliar, and I need some basic explanation so I can better trace code.
That’s actually two separate method calls.
The first is
This is calling the
static method appon “class Mage”, which can be found inThe
::operator calls static class methods. If you don’t understand what that means, just think “class on the left, method on the right, and you can’t use a $this variable inside the method”.So, this method call returns an object, which will almost certainly be a
Mage_Core_Model_App, which is atSo the one liner above could be rewritten as
Hope that helps demystify things a bit.