Magento – Get Widget Instance Title

magento-1.9page-titlePHPwidget-instance

I'm creating a template for a widget and would like to echo the widget title in my PHP code. What is the proper way of doing that?

The following does not work:

<?php echo $this->getTitle() ?>

Note: this is part of a custom PHTML file in my theme.

Best Answer

<?php $widgetId =1;
$widget = Mage::getModel('widget/widget_instance')->load($widgetId);
echo $widget->getTitle(); ?>

Try this it's working...