I want it to appear on all pages. I Just dont want the code in the main.php file. I suppose main.php file in the layouts is not suitable for this data.
If we are talking about views/layouts/main.php, then that is your default layout. Unless you specify other layout in the controller (or no layout at all), this file will be used to enclose your generated output (placing the latter at $content placeholder).
Yes we are talking about views/layouts/main.php. mainmenu is a widget which processes the menu items which are passed as parameters from the main.php file. I don’t want to place the code (parameters) for menu items here in the main.php and want to separate it from the layout file. Where can I put that?