Jump to content
kongondo

Menu Builder

Recommended Posts

On 6/13/2019 at 4:31 PM, uiui said:

Has anyone ever had the issue that changes to a menu won't save anymore? After adding page number 89 moving items isn't possible anymore as the change won't be saved. This is the case independent of the last page I add or where I move that page.

We had this issue recently, it's because of the limit of Input variables in your PHP configuration. Adjusting the value of max_input_vars in your php.ini file to a larger number will increase the number of items you can save 🙂

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
21 minutes ago, Asimov said:

We had this issue recently, it's because of the limit of Input variables in your PHP configuration. Adjusting the value of max_input_vars in your php.ini file to a larger number will increase the number of items you can save 🙂

Thanks @Asimov ! Excellent response! Welcome to the forums.

Share this post


Link to post
Share on other sites

Hello,

I need some help please. 😉 With "configuring the menu" and adding some additional stuff to my mobile menu, but not really sure how to do that.

I would like my Logo to show in my mobile menu, and I would also like the language switcher there, but cant figure it out. I tried all sorts of things but cant make it work.

My html looks like this: In html the logo is there, but when I try tu give it to menubuilder code it is gone. 

Spoiler

    <nav id="ro-main-nav" class="ro-main-nav-style-1">
      <div class="container">
        <div class="ro-brand"><a href="index.html"><img src="javascript:if(confirm('http://mysite.com/images/logo.svg\n\nThis file was not retrieved because it was filtered out by your project settings.\n\nWould you like to open it from the server?'))window.location='http://mysite.com/images/logo.svg'" alt="Logo"/><img src="javascript:if(confirm('http://mysite.com/images/logo.svg\n\nThis file was not retrieved because it was filtered out by your project settings.\n\nWould you like to open it from the server?'))window.location='http://mysite.com/images/logo.svg'" alt="Logo"/></a></div>
        <ul class="ro-nav-content text-center">
          <li class="visible-xs"><a href="index.html"><img src="javascript:if(confirm('http://mysite.com/images/logo.svg\n\nThis file was not retrieved because it was filtered out by your project settings.\n\nWould you like to open it from the server?'))window.location='http://mysite.com/images/logo.svg'" alt="Logo"/></a></li>
          <li><a href="index.html">HOME</a>
            <ul class="ro-sub-nav">
              <li><a href="basic.html">Link 1</a></li>
              <li><a href="fullwidth.html">Link 2</a></li>
              <li><a href="fullheight.html">Link 3</a></li>

            </ul>
          </li>
          <li><a href="about.html">PAGES</a>
            <ul class="ro-sub-nav">
              <li><a href="about.html">About Us</a></li>
              <li><a href="404.html">Page 2</a></li>
            </ul>
          </li>
          <li><a href="service.html">SERVICES</a></li>
          <li><a href="shop.html">SHOP</a>
            <ul class="ro-sub-nav">
              <li><a href="product.html">Product Page</a></li>
              <li><a href="cart.html">Page</a></li>
              <li><a href="checkout-1.html">Also page</a></li>
            </ul>
          </li>
          <li><a href="contact.html">CONTACT</a></li>
        </ul>
        <div id="ro-hamburger" class="ro-hamburger visible-xs pull-right"><span></span></div>
      </div>
    </nav>

I've tried with:

Spoiler

<nav id="ro-main-nav" class="ro-main-nav-style-1">
      <div class="container">
        <div class="ro-brand"><a href="<?=$config->urls->root;?>"><img src="<?=$pages->get("/Nastavitve/")->header_logo->url?>'" alt="logo"/></a></div>
          <?php 
                        $menu = $modules->get('MarkupMenuBuilder');
                        $options = array(

                            'wrapper_list_type' => 'ul',// ul, ol, nav, div, etc.
                            'list_type' => 'li',// li, a, span, etc.
                            'menu_css_id' => '',// a CSS ID for the menu
                            'menu_css_class' => 'ro-nav-content text-center',// a CSS Class for the menu
                            'submenu_css_class' => 'ro-sub-nav',// CSS Class for sub-menus
                            'has_children_class' => 'ro-sub-nav',// CSS Class for any menu item that has children
                            'first_class'=>'',// CSS Class for the first item in 
                            'last_class' => '',
                            'current_class' => 'active',
                            'default_title' => 0,// 0=show saved titles;1=show actual/current titles
                            'include_children' => 4,// show 'natural' MB non-native descendant items as part of navigation
                            'm_max_level' => 1,// how deep to fetch 'include_children'
                            'current_class_level' => 1,// how high up the ancestral tree to apply 'current_class'
                            'default_class' => '',// a CSS class to apply to all menu items
                        );
                        echo $menu->render(1163, $options);
                        ?>

        <div id="ro-hamburger" class="ro-hamburger visible-xs pull-right"><span></span></div>
      </div>
    </nav>

but there is no logo inside. I also tried with both upper codes and added images to them but not working.

And second question, I would also like to put language switcher to it, not sure how to combine this ...

Spoiler

<ul class="ro-nav-content text-center">
<?php
$savedLanguage = $user->language;

foreach($languages as $language) {
  if($language->id == $savedLanguage->id) continue;
  if(!$page->viewable($language)) continue;
  $user->language = $language;
  echo "<li><a href='$page->url'>$language->title</a></li>";
}
$user->language = $savedLanguage;

?>
</ul>

I hope u understand what Im trying to do. Any help would be appreciated. 😉

Thank you

R

Share this post


Link to post
Share on other sites

HI there, 

Very nice module thank you.

I would like to put a class in each of the ul of the sub menus I have in my menu. It seems that through the admin interface or the $option of the render() function I can't achieve this. Is this correct ?

Then would the only  way to do this is the getMenuItems() function and coding the menu's markup ?

Thanks 

Share this post


Link to post
Share on other sites

ok... I am answering my own (stupid) question in case it's of any help to somebody.

To add a class in the ul of each submenu. Use the 'submenu_css_class' in the $option array. 

Share this post


Link to post
Share on other sites

Hey guys, I've been using the MenuBuilder for quite a few projects (thanks @kongondo for the great module and support!), however this time it is my first when I need to use a menu in the sidebar if some pages are added to it. It all works as soon as I add a few items to the menu, however there is one little issue I am having - not knowing how to show the block title ONLY if the menu contains some items added. I've been looking through the module functions etc. to figure it out, however for some reason I am always getting the items count as 1 even though I've added 9.

<?php
        //Building the array of options. The ones that are not used can be removed
        //They are left here for the learning process only.
        $options = array(
         'wrapper_list_type' => 'ul',// ul, ol, nav, div, etc.
         'list_type' => 'li',// li, a, span, etc.
         'menu_css_id' => '',// a CSS ID for the menu
         'menu_css_class' => 'category-list',// a CSS Class for the menu
         'current_class' => 'active',
         'default_title' => 0,// 0=show saved titles;1=show actual/current titles
         'include_children' => 4,// show 'natural' MB non-native descendant items as part of navigation
         'm_max_level' => 1,// how deep to fetch 'include_children'
         'current_class_level' => 1,// how high up the ancestral tree to apply 'current_class'
        );

        // Render the menu by title
        $cat_menu = $menu->render(1108, $options);
        echo "This menu has: " . count($cat_menu);
        echo $cat_menu;

       ?>	

The big question here is, how can I add a check if my menu with a specific ID/title would contain some items or is just empty in order to show or not the block title etc.?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      Although the PW backend is really intuitive, ever so often my clients need some assistance. Be it they are not so tech savvy or they are not working in the backend often.
      For those cases it is nice to make some help videos available to editors. This is what this module does.
      ProcessHelpVideos Module
      A Process module to display help videos for the ProcessWire CMS. It can be used to make help videos (screencasts) available to content editors.
      This module adds a 'Help Videos" section to the ProcessWire backend. The help videos are accessible through an automatically created page in the Admin page tree. You can add your help videos as pages in the page tree. The module adds a hidden page to the page tree that acts as parent page for the help video pages. All necessary fields and templates will be installed automatically. If there are already a CKEditor field and/or a file field for mp4 files installed in the system, the module will use those. Otherwise it will create the necessary fields. Also the necessary templates for the parent help videos page and it's children are created on module install. The module installs a permission process-helpvideos. Every user role that should have access to the help video section, needs this permission. I use the help video approach on quite a few production sites. It is stable so far and well received by site owners/editors. Up until now I installed required fields, templates and pages manually and then added the module. Now I added all this logic to the install method of the module and it should be ready to share.
      The module and further description on how to use it is available on github: https://github.com/gebeer/ProcessHelpVideos
      If you like to give it a try, I am happy to receive your comments/suggestions here.
    • By Robin S
      A module created in response to the topic here:
      Page List Select Multiple Quickly
      Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page.
      The screencast says it all:

       
      https://github.com/Toutouwai/PageListSelectMultipleQuickly
      https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    • By gebeer
      Hello all,
      sharing my new module FieldtypeImagePicker. It provides a configurable input field for choosing any type of image from a predefined folder.
      The need for it came up because a client had a custom SVG icon set and I wanted the editors to be able to choose an icon in the page editor.
      It can also be used to offer a choice of images that are used site-wide without having to upload them to individual pages.
      There are no image manipulation methods like with the native PW image field.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImagePicker
      Kudos to @Martijn Geerts. I used his module FieldTypeSelectFile as a base to build upon.
      Here's how the input field looks like in the page editor:

      Hope it can be of use to someone.
      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Eventually this will go in the module directory soon, too.
    • By bernhard
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public.
      Description from PW Weekly:
       
      Modules Directory: https://modules.processwire.com/modules/rock-pdf/
      Download & Docs: https://github.com/BernhardBaumrock/RockPDF
       
      You can combine it easily with RockReplacer: 
      See also a little showcase of the RockPdf module in this thread:
       
    • By ukyo
      FieldtypeFontIconPicker
      Supported Icon Libraries
      FontAwesome 4.7.0 Uikit 3.0.34 IonicIcons 2.0.1 Cahangelog
      NOTE: Module store data without prefix, you need to add "prefix" when you want to show your icon on front-end, because some of front-end frameworks using font-awesome with different "prefix".
      Module will search site/modules/**/configs/IconPicker.*.php and site/templates/IconPicker.*.php paths for FieldtypeFontIconPicker config files.
      All config files need to return a PHP ARRAY like examples.
      Example config file : create your own icon set.
      File location is site/configs/IconPicker.example.php
      <?php namespace ProcessWire; /** * IconPicker : Custom Icons */ return [ "name" => "my-custom-icons", "title" => "My Custom Icon Set", "version" => "1.0.0", "styles" => array( wire("config")->urls->templates . "dist/css/my-custom-icons.css" ), "scripts" => array( wire("config")->urls->templates . "dist/js/my-custom-icons.js" ), "categorized" => true, "attributes" => array(), "icons" => array( "brand-icons" => array( "title" => "Brand Icons", "icons" => array( "google", "facebook", "twitter", "instagram" ) ), "flag-icons" => array( "title" => "Flag Icons", "icons" => array( "tr", "gb", "us", "it", "de", "nl", "fr" ) ) ) ]; Example config file : use existing and extend it.
      File location is site/configs/IconPicker.altivebir.php
      <?php namespace ProcessWire; /** * IconPicker : Existing & Extend */ $resource = include wire("config")->paths->siteModules . "FieldtypeFontIconPicker/configs/IconPicker.uikit.php"; $url = wire("config")->urls->templates . "dist"; $resource["scripts"] = array_merge($resource["scripts"], ["{$url}/js/Altivebir.Icon.min.js"]); $resource["icons"]["flag-icons"] = [ "title" => "Flag Icons", "icons" => array("tr", "en", "fr", "us", "it", "de") ]; $resource["icons"]["brand-icons"]["icons"] = array_merge($resource["icons"]["brand-icons"]["icons"], array( "altivebir" )); return $resource; After you add your custom config file, you will see your config file on library select box. Library Title (Location Folder Name).

      If your library categorized and if you have categorized icons set like uikit and fontawesome libraries, you will have category limitation options per icon field or leave it empty for allow all categories (default).

      Example : output
      if ($icon = $page->get("iconField")) { echo "<i class='prefix-{$icon}' />"; } MarkupFontIconPicker Usage
      // MarkupFontIconPicker::render(YourIconField=string, Options=array) echo MarkupFontIconPicker::render($page->YourIconField, [ 'prefix' => 'uk-icon-', // Icon class prefix, if you have different prefix, default is : "fa fa-" 'tag' => 'span', // Icon tag default is : "i" 'class' => 'fa-lg', // If you have extra cutom classes, for example : icons sizes, Array or Sting value 'style' => 'your custom styles if you have' // Array or String Value ]); Theme support

      Search support

      Category support

       
×
×
  • Create New...