Plugin Variable.php Problem I want to get the developer name from Plugin.php using the getDeveloper() method so I created a function devName() in Variable.php

public function devName() {
    return craft()-&gt;crmPortal-&gt;getDeveloper();
}


but when i want it to print it in my template, using this {{craft.crmPortal.devName}} I'm having this Error. Property "Craft\WebApp.crmPortal" is not defined.
It sounds like you're attempting to access the getDeveloper method on your plugin's main service class, but the class doesn't exist.

You have two options:


Create the service class, and implement a getDeveloper method.
Call the getDeveloper method on your main plugin class (which I suspect is what you're really trying to do).


Option One: Service

Your minimal service class will look like this:

&lt;?php

namespace Craft;

class CrmPortalService extends BaseApplicationComponent
{
    /**
     * Returns the developer name.
     *
     * You could either hard-code the developer name, or you could
     * retrieve it from the main plugin class, as described in
     * option two.
     *
     * @return string
     */
    public function getDeveloper()
    {
        return 'John Doe';
    }
}


Option Two: Plugin

Craft uses Services to expose functionality, in exactly the same way that plugins do. If you're trying to figure out how to do something, just look for a Craft Service with a similar name.

In this case, you want to retrieve your main plugin file, so the PluginsService is a good place to start. We're in luck, it has a getPlugin method, which accepts a plugin handle, and returns the plugin class.

Here's how you might use that, to call the getDeveloper method in your main plugin class.

craft()-&gt;plugins-&gt;getPlugin('crmPortal')-&gt;getDeveloper();