<p>This should do it:</p>

<pre><code>{% if craft.cornballer is defined %}
    Never fear... CornBaller is here.
{% else %}
    I'm missing my CornBaller.
{% endif %}
</code></pre>

CC BY-SA 3.0
2015-02-06T23:41:46.753Z
Damn. I'm embarrassed that `is defined` didn't occur to me. Thank you, Brad.
Matt Stein
CC BY-SA 3.0
2015-02-06T23:39:35.807Z
2015-02-06T23:39:35.807Z
Brad Bell
<p>Let's say I've got a hot plugin called Cornballer, and I'd like to avoid embarrassing template errors <strong>if I refer to it in a template without yet installing it</strong>.</p>

<p>I'd like to get away with this...</p>

<pre><code> {% if craft.cornballer %}

 {{ craft.cornballer.simulate('little') }}

 {% endif %}
</code></pre>

<p>...so that any cornballing is simply ignored and no errors result. But Craft allows no such thing:</p>

<blockquote>
  <p>Method "cornballer" for object "Craft\CraftVariable" does not exist </p>
</blockquote>

<p>Is there a way?</p>

<templating><plugins>
Is there a template conditional to determine whether a plugin is installed?
# Is there a template conditional to determine whether a plugin is installed?

(Asked by: username_0 on 2015-02-06)

Let's say I've got a hot plugin called Cornballer, and I'd like to avoid embarrassing template errors if I refer to it in a template without yet installing it.
I'd like to get away with this...
 {% if craft.cornballer %}

 {{ craft.cornballer.simulate('little') }}

 {% endif %}

...so that any cornballing is simply ignored and no errors result. But Craft allows no such thing:

Method "cornballer" for object "Craft\CraftVariable" does not exist 

Is there a way?

**Tags:** templating, plugins


---

## 1 answers

### Answer by username_1 on 2015-02-06. Score: 6 | Accepted answer

This should do it:
{% if craft.cornballer is defined %}
    Never fear... CornBaller is here.
{% else %}
    I'm missing my CornBaller.
{% endif %}

> **Comments:**
> **username_0**: Damn. I'm embarrassed that `is defined` didn't occur to me. Thank you, Brad.  

---

