How are you trying to use it in the template?
Below is a very basic way of how to display a setting in a front end twig template.
First define your settings with the defineSettings() method (as you already have).
protected function defineSettings()
{
return array(
'mySetting' => array(AttributeType::String, 'required' => true)
);
}
Then create a directory in the root of your plugin folder and call it “templates”. Create a new .html or .twig file in that folder and call it “_settings.html”. Inside of that you could put the following:
{% import "_includes/forms" as forms %}
{{ forms.textField({
label: "My Setting"|t,
id: 'mySetting',
name: 'mySetting',
instructions: "Input your setting"|t,
value: settings.mySetting,
errors: settings.getErrors('mySetting')
})
}}
After this go back to your primary plugin class and add the getSettingsHtml() method:
public function getSettingsHtml()
{
return craft()->templates->render(‘pluginHandle/_settings', array(
'settings' => $this->getSettings()
));
}
Now, if you go into admin/settings/plugins you can click on your plugin and there will be an input field there where you can save the setting. If you wanted to get this value you could add a method to your service like this:
public function getMySetting()
{
$plugin = craft()->plugins->getPlugin(‘pluginHandle');
$settings = $plugin->getSettings();
return $settings->mySetting;
}
You could call this anywhere throughout your plugin like this:
craft()->pluginHandle_serviceName->getMySetting();
To do that on the front end in a twig template, just create a method in the variables class. It would look something like this:
public function getMySetting()
{
return craft()->pluginHandle_serviceName->getMySetting();
}
In your front end twig template you could call it like this;
{{ craft.pluginHandle.getMySetting() }}
I hope any of this clears it up a bit.