spyMenuPlugin - 0.1.8

With this plugin you could create menu into a menu.yml or into a database

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source | Show as Markdown


With this plugin you could create menu into a menu.yml or into a database

How to install

  symfony plugin-install http://plugins.symfony-project.com/spyMenuPlugin

Where you want to see the menu

Add into view.yml

    stylesheets:    [ spyMenuIndex/menu ]


    javascripts:    [spyMenuIndex/fsmenu ]( spyMenuIndex/menu,)

Administration with DB

To activate the plugin add into you admin apps for the settings.yml

  enabled_modules:        [..., spyMenuManager](default,)

Component with DB


  enabled_modules:        [..., spyDbMenu](default,)




The spyMenuManager allow you to manage the DB module


If you want to use the menu.yml configuration create your menu.yml into your apps config directory

The structures is the next one :

    nom: {{MENU_TITLE}}
    help: {{MENU_HELP_MSG}} #For the spyMenuIndex module describe aftee (optionnal)
    url: {{INTERNAL_URI}} #Intrenal uri for url_for()
    icon: {{ICON_PATH}} #For an image_tag (visibility depends of your renderind) You'have got some icon into the icon folder of this module
    credentials: {{CREDENTIALS}} # Optionnal [cred2 ]( cred1,)

== spyMenuIndex ==

If you want to have a view for your background with a table off the list of subActions for this module, you can use spyMenu

The page spyMenu show all of the menu and spyMenu/start_by show the menu starting at the level of start_by

== Creating our view ==

If you want to create our module extend of spyMenu Like for show the structure of the catégories of your website or creating an other submenu to set into an other place of your website do like that :

=== Exemple 1 : Creating An expandable TreeMenu ===

Into your template


Into the lib directory of your app or module if it's only for one module Create the file myMenuConfigurationClass.class.php

With this code :

 * The treeMenu in this demo is stored into A DB because 
 * treeMenuConfig is extended of DbMenuConfig
 class myMenuConfigurationClass extends treeMenuConfig {
    public function getMenusAtLevel($level){
        $c=new Criteria();

        foreach($liste as $v){

        return $menus;

If you want to change the template set

 class myMenuConfigurationClass extends treeMenuConfig {
     public function getTemplateClass(){
            return '{{MY_PERSONNAL_CLASS}}';

class {{MY_PERSONNAL_CLASS}} extends treeMenu {
    public function renderHtml(){
            Create here your rendering


To manage the rights if you want to hide a module if the user haven't got the rights, for that you must define the credentials And after set

class {{MY_PERSONNAL_CLASS}} extends treeMenu {
    public function isAllowed(){
        Return true or false
        return true;

Why my menu is not actualisated ?

The menu can be saved into your session when it's into a BDD

Try to pass the ?recalcul=1 into you url