<p>MyPlugin<code>Varaible</code> Note the spelling of the highlighted word...</p>

CC BY-SA 3.0
2015-12-20T20:10:55.867Z
2015-12-20T20:10:55.867Z
andrew.welch
<p>I am brand new to craft and have loved it so far.  Only area that I'm having a hard time understanding is why I cannot use my template variables in my templates.</p>

<p>I am routing <code>news/</code> to an action which then uses the <code>renderTemplate()</code> method to do just that...render the template.  The result is sent to the browser but it is accompanied by the following php error:</p>

<pre><code>Fatal error: Cannot declare class Craft\WassermanNewsVaraible, because the name 
is already in use in /usr/share/nginx/craft/plugins/myPlugin/variables/MyPluginVariable.php on line 5
</code></pre>

<p>So that tells me that the class is obviously already declared somewhere.  If so how can I access it?  I am currently trying to access it as the documentation describes and is shown below:</p>

<pre><code>{% for item in craft.myPlugin.myMethod() %}
  &lt;div&gt;
   Test
  &lt;/div&gt;
{% endfor %}
</code></pre>

<p>Here is my template variable class which is in myPlugin/variables/</p>

<pre><code>namespace Craft;

class MyPluginVaraible
{
    public function myMethod(){
        craft()-&gt;myPlugin-&gt;myMethod(); //which is in the service
    }
}
</code></pre>

<p>Is there a difference between how templates are rendered via controllers as opposed to the regular behavior?  I saw that the method had a second parameter however I still could not insatiate my template variables to pass that way as it was still already declared somewhere.</p>

<p>I've been banging away at this one for a while.  Any help or insight would be much appreciated.</p>

<templating>
Template Variable Already in Use?
# Template Variable Already in Use?

(Asked by: username_0 on 2015-12-20)

I am brand new to craft and have loved it so far.  Only area that I'm having a hard time understanding is why I cannot use my template variables in my templates.
I am routing news/ to an action which then uses the renderTemplate() method to do just that...render the template.  The result is sent to the browser but it is accompanied by the following php error:
Fatal error: Cannot declare class Craft\WassermanNewsVaraible, because the name 
is already in use in /usr/share/nginx/craft/plugins/myPlugin/variables/MyPluginVariable.php on line 5

So that tells me that the class is obviously already declared somewhere.  If so how can I access it?  I am currently trying to access it as the documentation describes and is shown below:
{% for item in craft.myPlugin.myMethod() %}
  
   Test
  
{% endfor %}

Here is my template variable class which is in myPlugin/variables/
namespace Craft;

class MyPluginVaraible
{
    public function myMethod(){
        craft()->myPlugin->myMethod(); //which is in the service
    }
}

Is there a difference between how templates are rendered via controllers as opposed to the regular behavior?  I saw that the method had a second parameter however I still could not insatiate my template variables to pass that way as it was still already declared somewhere.
I've been banging away at this one for a while.  Any help or insight would be much appreciated.

**Tags:** templating

---

## 1 answers

### Answer by username_1 on 2015-12-20. Score: 3 | Accepted answer

MyPlugin`Varaible` Note the spelling of the highlighted word...


---

