How to render menus in social engine

In Social engine you can create new menus just like other CMS. For creating new menus or Add new menu item in existing menus you need to go to Admin panel and select menu editor option under Layout menu.

admin -> Layout -> Menu editor

- Select the Menu from drop-down whatever you want to edit.

- After selecting menu you can Add new menu item using add item link or edit/delete the already added menu items.

- You can also create new menu by click on Add Menu link. 


Menu Navigation Social Engine

More for info in details please click on following link:


Now developer needs to render that menus for this you can used that following code into controller file.

    $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')
      ->getNavigation('menu name');

You need to change "blog_main" with your menu name. After that you need to call that navigation into tpl file using following code


        // Render the menu
        echo $this->navigation()
          ->menu()
          ->setContainer($this->navigation)
          ->render();

Live Example:

controllers index action:

public function indexAction()
  {
    // Get navigation
    $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')
      ->getNavigation('blog_main');
  }

index.tpl 

<?php
        // Render the menu
        echo $this->navigation()
          ->menu()
          ->setContainer($this->navigation)
          ->render();
      ?>


Post a Comment

0 Comments