Im working on my first site in drupal and I have also read some basics of theming and module development. Now I am creating (overriding stark theme) my own theme, i.e. page.tpl.php and there is an theme() function called for outputting main menu items:
<?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Main menu'))); ?>
I roughly understand what this function is for, but why should I use it in this case? It would make sense if outputting data from module - to stylize that output by selected theme. But in this case everything I need is directly in $main_menu
array and I can stylize it however I want, so what's the use for theme()
function in page.tpl.php
?