Plugin Variable can't find template I'm new to Craft template development and one of the first things I'm trying to do is create a Variable that renders a template into the template its called from.

My directory structure looks like this:

/craft
  /plugins
    /test
      /templates
        _headers.html
      /variables
        TestVariable.php


Here is the Variable:

&lt;?php

namespace Craft;

class TestVariable
{
    /**
     * Get header for test code
     *
     * @return string
     */
    public function headers()
    {
        return craft()-&gt;templates-&gt;render('test/_headers');
    }
}


And I'm calling it in the template with a simple: {{ craft.test.headers }}

My template is erroring with Unable to find the template “test/_headers”.

What am I misunderstanding here?
Just added this note to the Plugin Templates documentation, which should answer your question:




  Craft will only automatically look for templates within the plugin folders for CP requests. If you are going to be calling TemplatesService::render() from a front end site request, you will need to manually tell Craft where to find your template using PathService::setTemplatesPath() first:

$oldPath = craft()-&gt;path-&gt;getTemplatesPath();
$newPath = craft()-&gt;path-&gt;getPluginsPath().'pluginHandle/templates';
craft()-&gt;path-&gt;setTemplatesPath($newPath)
$html = craft()-&gt;templates-&gt;render('path/to/template');
craft()-&gt;path-&gt;setTemplatesPath($oldPath);

  
  If you do this, you won’t be needing to begin the template path with your plugin handle.