Hi
Can you please point me in the right direction. I’m new to Yii and i would like to display Google adverts on my website. I’ve got a google client # and channel #.
Thanks
Hi
Can you please point me in the right direction. I’m new to Yii and i would like to display Google adverts on my website. I’ve got a google client # and channel #.
Thanks
Hi welcome to the forum.
You can create a widget. Like this:
class AdSenseWidget extends CWidget
{
public $clientId;
public $channelId;
public function run()
{
// output the adsense code here
// like...
echo "http://example.com/showads?clientId={$this->clientId}&channelId={$this->channelId}";
}
}
Then to display the widget within a view:
$this->widget('AdSenseWidget', array('clientId' => 123, 'channelId' => 456));
Take a look at the widget doc or use the site search for more info.
hi
Many Thanks for your reply. I’ll try that!