Answers.Body: <p>There are multiple issues happening here...</p>
  
  <ol>
  <li><p>The Twig code should look like this:</p>
  
  <pre><code>{{ craft.businessLogic.exampleVariable() }}
  </code></pre></li>
  <li><p>As noted in that example, Twig can't communicate directly with a Service level method. You'll need to ping the Variable class, and use your Variable method to call the Service method.</p></li>
  </ol>
  
  <p>Optional...</p>
  
  <ol start="3">
  <li>The Business Logic plugin template currently only works with Craft 2. If you're attempting this on a Craft 3 site, several things would need to be changed.</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-16T17:28:15.663Z
Answers.LastActivityDate: 2018-08-16T17:28:15.663Z
Answers.UserDisplayName: Lindsey D
Body: <p>I'm just starting with plugins and I've downloaded the Business Logic plugin and am trying to call it from my template.  </p>
  
  <p>Here's the code in my template:</p>
  
  <pre><code>{% extends "_layout" %}
  
  {% block content %}
  {{craft()-&gt;businessLogic-&gt;exampleService()}}
  
  {% endblock %}
  </code></pre>
  
  <p>And the code in the BusinessLogicService.php:</p>
  
  <pre><code>class BusinessLogicService extends BaseApplicationComponent
  
  {
  
      /**
       * This function can literally be anything you want.
       *
       * HOW TO USE IT
       * From any other plugin file, call it like this:
       *
       *     craft()-&gt;businessLogic-&gt;exampleService()
       *
       */
      public function exampleService()
      {
          return "I've got your data right here!";
      }
  
  }
  </code></pre>
  
  <p>It returns this error:</p>
  
  <pre><code>Unknown "craft" function.
  </code></pre>
  
  <p>Would I call it a different way?<br>
  Thanks for any help with this.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-08-16T17:21:37.697Z
Comments.Text: Is this a Craft 2 site or a Craft 3 site?
Comments.UserDisplayName: Lindsey D
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-08-16T20:28:24.550Z
Comments.Text: It's a Craft 2 site.
Comments.UserDisplayName: buck1112
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-08-16T21:16:11.820Z
Comments.Text: You can also generated your plugin scaffolding here: https://pluginfactory.io/ -- so you'll get just what you want.
Comments.UserDisplayName: andrew.welch
Tags: <plugins><services>
Title: "Unknown "craft" function" Error in Plugin Service Call
ThreadText: # "Unknown "craft" function" Error in Plugin Service Call
  
  (Asked by: username_0 on 2018-08-16)
  
  I'm just starting with plugins and I've downloaded the Business Logic plugin and am trying to call it from my template.
  
  Here's the code in my template:
  
  ```
  {% extends "_layout" %}
  
  {% block content %}
  {{craft()->businessLogic->exampleService()}}
  
  {% endblock %}
  
  ```
  
  And the code in the BusinessLogicService.php:
  
  ```
  class BusinessLogicService extends BaseApplicationComponent
  
  {
  
      /**
       * This function can literally be anything you want.
       *
       * HOW TO USE IT
       * From any other plugin file, call it like this:
       *
       *     craft()->businessLogic->exampleService()
       *
       */
      public function exampleService()
      {
          return "I've got your data right here!";
      }
  
  }
  
  ```
  
  It returns this error:
  
  ```
  Unknown "craft" function.
  
  ```
  
  Would I call it a different way?  
  Thanks for any help with this.
  
  **Tags:** plugins, services
  
  > **Comments:**
  > **username_1**: Is this a Craft 2 site or a Craft 3 site?  
  > **username_0**: It's a Craft 2 site.  
  > **username_2**: You can also generated your plugin scaffolding here: https://pluginfactory.io/ -- so you'll get just what you want.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-16. Score: 1
  
  There are multiple issues happening here...
  
  1. The Twig code should look like this:
  
     ```
     {{ craft.businessLogic.exampleVariable() }}
  
     ```
  2. As noted in that example, Twig can't communicate directly with a Service level method. You'll need to ping the Variable class, and use your Variable method to call the Service method.
  
  Optional...
  
  3. The Business Logic plugin template currently only works with Craft 2. If you're attempting this on a Craft 3 site, several things would need to be changed.
  
  
  ---
  
  