I am hoping that somebody can help with this issue.
I followed this excellent tutorial on creating a custom widget in Craft. On completion, I uploaded the plugin to the /craft/plugins/
directory, visited the page at /admin/settings/plugins
and installed the plugin. All fine so far. Then, on returning to the dashboard, I clicked on New Widget, and selected the name of the widget. Following this, a message flashed up saying 'An unknown error occurred.' and little else happened.
It's probably user error, but if you could point out what I might have done incorrectly, that'd be useful.
My Plugin Structure
The plugin's called Adlister
and the widget's called Alu
, so in /craft/plugins/adlister/
I have two folders ( templates/
and widgets/
), and a file: AdListerPlugin.php
. Within templates/
is a file: AluWidget.html
and within widgets/
is AdLister_AluWidget.php
.
File Contents
AdListerPlugin.php
<?php
namespace Craft;
class AdListerPlugin extends BasePlugin
{
function getName()
{
return Craft::t('AdLister');
}
function getVersion()
{
return '1.0';
}
function getDeveloper()
{
return 'Mark Syred';
}
function getDeveloperUrl()
{
return 'http://www.sypo.uk';
}
}
AluWidget.html
<p>Click to perform <a href="http://example.co.uk/adlister-update.php?numDays=1">a daily update</a>.</p>
<p>Click to perform <a href="http://example.co.uk/adlister-update.php?numDays=3">an update on a Monday</a>.</p>
<p>Click to perform <a href="http://example.co.uk/adlister-update.php?numDays=7">a weekly update</a>.</p>
<p>Click to perform <a href="http://example.co.uk/adlister-update.php?numDays=30">a monthly update</a>.</p>
AdLister_AluWidget.php
<?php
namespace Craft;
class Adlister_AluWidget extends BaseWidget
{
public function getName()
{
return Craft::t('Adlister Update');
}
public function getBodyHtml()
{
return craft()->templates->render('adlister/AluWidget');
}
}
Any help that anyone could provide would be much appreciated.
With kind regards,
Mark
UPDATE
I don't know if this has any bearing, but the version of Craft I'm running is 2.6.2911.
/craft/storage/runtime/logs
(search for[error]
and possibly your server error log files as well – might be a clue in there.