Unknown error

Hello,

I’m working on a plugin. I wish I create a plugin based on the basic model that multisite. Ie, having a personalized summary page.
I create begin to create my plugin and when I test, I get lots of error from the tmp/

File AllSites.php


class Piwik_AllSites extends Piwik_Plugin {
	
	public function getInformation()
	{
		return array(
				'description' 			=> Piwik_Translate('AllSites_PluginDescription'),
				'author' 				=> 'Djik',
				'version' 				=> '1.0.0',
				'translationAvailable' 	=> true,
		);
	}
	
	public function getListHooksRegistered()
	{
		return array(
			'TopMenu.add' => 'addTopMenu',

		);
	}
	
	public function addTopMenu()
	{
		$urlParams = array('module' => 'AllSites', 'action' => 'index');
		$tooltip = Piwik_Translate('AllSites_alt');
		Piwik_AddTopMenu(Piwik_Translate('AllSites_title_url'), $urlParams, true, 5, $isHTML = false, $tooltip);
	}
}

File Controller.php


class Piwik_AllSites_Controller extends Piwik_Controller{
	
	public function index(){
		
		$view = new Piwik_View("AllSites/templates/index.tpl");
		
		var_dump('test');

		echo $view->render();
	}
	
}

File idex.tpl


{assign var=showSitesSelection value=false}
{assign var=showPeriodSelection value=false}
{include file="CoreAdminHome/templates/header.tpl"}

Here is the list of errors :



Notice: Undefined index: topMenu in /var/www/sis1/stats/G01R04C02/tmp/templates_c/%%A5^A51^A51D6D8B%%top_bar.tpl.php on line 8
Notice: Undefined index: isCustomLogo in /var/www/sis1/stats/G01R04C02/tmp/templates_c/%%C3^C3C^C3C9B2C7%%logo.tpl.php on line 10
Notice: Undefined index: menu in /var/www/sis1/stats/G01R04C02/tmp/templates_c/%%F7^F70^F708E4D1%%menu.tpl.php on line 5  
Notice: Undefined index: usingOldGeoIPPlugin in /var/www/sis1/stats/G01R04C02/tmp/templates_c/%%38^383^383EA889%%header.tpl.php on line 108


How do I fix these notices? And why there are this notice ? These variables are not defined in Multisites, and I is not these notices, why?

For a good intro into writing a plugin read: How to write a Piwik Plugin

You receive these notices because you need to call setGeneralVariablesView() on the View object. The Multisites plugin does that in: matomo/Controller.php at master · matomo-org/matomo · GitHub

Thank you Fabian.

With setGeneralVariablesView (), ca solves some problems but not all.

I still have two errors:


Notice: Undefined index: menu in /var/www/sis1/stats/G01R04C02/tmp/templates_c/%%F7^F70^F708E4D1%%menu.tpl.php on line 5  
Notice: Undefined index: usingOldGeoIPPlugin in /var/www/sis1/stats/G01R04C02/tmp/templates_c/%%38^383^383EA889%%header.tpl.php on line 108

But I change the Controller.php:


class Piwik_AllSites_Controller extends Piwik_Controller{
	
	public function index(){
		
		//$view = new Piwik_View("AllSites/templates/index.tpl");
		$view = Piwik_View::factory('index');
		//$this->setGeneralVariablesView($view);
		$this->setBasicVariablesView($view);
		
		//var_dump('test');
		
		$view->isSuperUser = TRUE;
		echo $view->render();
	}
	
}

From where can get these two errors? I even try to refresh the template cache but it does nothing: s