Jump to content

Search the Community

Showing results for tags 'menu'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 27 results

  1. I want to remove the "Home" page from the navbar, but keep the other pages (About, Templates, etc) on the navbar? How is this done?
  2. Hello PW Community, really glad that discovered this CMS recently, it is very strange it took so long That idea of no front design limitations is just awesome! Need to say that I have a bit of knowledge of html and css, but almost no php, so I need your help. What I want to do is an article posting cms, with this structure: - Homepage - Projects - Articles -- Category 1 --- Articles of category 1 -- Category 2 --- Articles of category 2 - About - Contact Found this ProcessWire Profile https://github.com/tutsplus/how-to-create-an-ajax-driven-theme-for-processwire It covers almost all my needs, except the menu. When I add a childpage for this page http://artist.nicegrp.com/publications/world-world/ , World:World doesn't appear under Writings & Publications. I need a menu that works like a breadcrumb, that shows on the menu the category that you are viewing. So when I'm in articles page, on the menu it shows only articles and it's categories. When I get into a category, that category takes state active link but doesn't show on the menu links and titles for contained articles. How can I do that? Sorry for my long writing and English, it is not my native but I hope you understood what I need. Can you help me with that? Thank you
  3. hi everyone I am trying get a full width sub-menu on 3rd item in menu or navbar which is coming from a loop. i was hoping this can be done by using jquery by targeting 3rd element in navbar but jquery is blocked in some browser by default so is there any other method I can do this
  4. I'm trying to understand how I could have users log in as "members", provide them with a customized experience, but still serve them cached pages? For example let's say I have 3 roles Guest Member SuperUser And let's say I have a NavBar type component that has a menu. Plus it has "log in!" if guest, or "logged in as Mike Smith" I would want guests to see a cached site with guest-only page access. Members should also see cached pages, but their menu may have access to members-only pages or fields or information. Furthermore they might have a "logged in as Mike Smith" element. SuperUsers can stay uncached. How does one go about creating that cache so that visitors aren't constantly re-creating the menu? Or that when "Sally Baker" logs in, she doesn't see a homepage that is cached for "Mike Smith" with all his elements? Thank you in advance for any replies.
  5. I tried the demo template and discovered that also other menu builders are using the Status field of a page called "Hidden: Excluded from lists and searches" for the decision if a page should be part of the menu or not. $children = $homepage->children(); // does obviously read all non-hidden pages foreach($children as $child) {...} The admin should be able to decide: [ x ] show in menu [ x ] hidden from searches Combining those options into one field is by design wrong. Or have I missed any other option here?
  6. how do i prepend home (root) to my rekursive menu this is the original code from ryan <?php function treeMenu(Page $page = null, Page $rootPage = null) { if(is_null($page)) $page = wire('page'); if(is_null($rootPage)) $rootPage = wire('pages')->get('/'); $out = "\n<ul>"; $parents = $page->parents; foreach($rootPage->children as $child) { $class = "level-" . count($child->parents); $s = ''; if($child->numChildren && $parents->has($child)) { $class .= " on_parent"; $s = str_replace("\n", "\n\t\t", treeMenu($page, $child)); } else if($child === $page) { $class .= " on_page"; if($page->numChildren) $s = str_replace("\n", "\n\t\t", treeMenu($page, $page)); } $class = " class='$class'"; $out .= "\n\t<li>\n\t\t<a$class href='{$child->url}'>{$child->title}</a>$s\n\t</li>"; } $out .= "\n</ul>"; return $out; } echo treeMenu(); ?>
  7. I am using @Damienov's tweaked bootstrap menu for a project, but ran into a snag. I have a few pages that I dont want to display in the header navigation (but will be used in the footer, another hurtle). Does anyone have any advice on how to achieve this?
  8. Hello, i am trying to build one Page in CMS for menu Building. i have created a field name "menu_page" Page type & one text filed name "depth" now i have crated a new repeater name "menus" with above both fields. menus (repeater) menu_page (page type, single page) depth (text) now i add it one page name "header" and added values as bellow menus1 menu_page "about us" depth (0) menus2 menu_page "About Company" depth (1) menus3 menu_page "Products" depth (3) menus4 menu_page "Contact Us" depth (0) in my template file i have code as bellow <ul> <?php $menus=$pages->get("/header/"); foreach($menus as $menu) { ?> <li><a href="<?php echo $menu->url;?>"><?php echo $menu->title;?></a></li> <?php } ?> </ul> This shows TOP menu Menu but how to get SUB menu according to Dept of each menu. Thanks
  9. i want to output a menu with just one dropdown-option and an class="active" if the user is on the active page this is my tree – root –– page A –––– child page A –––– child page A –––– … –– page B ––– child page B ––– child page B ––– child page B –– page C ––– child page C ––– child page C and the output should be like this –– page A (just dropdown, no link! just text) –––– child page A (link) –––– child page A (link) –––– … –– page B (link) (children should not be listed) –– page C (link) (children should not be listed) and if the current page matches A, B and C matches on any level a class should be added to page A or B or C this my code so far but i dont how to make page B and C an link and page A just text and how not to output the children of page B and C <?php $root = $pages->get("/"); $children = $root->children(); foreach($children as $child) { $class = $child === $page->rootParent ? " class='on'" : ""; echo "<li $class ><a >{$child->title}</a>"; echo "<ul>"; foreach($child->children as $grandchild) { echo "<li ><a href='{$grandchild->url}'>{$grandchild->title}</a></li>"; } echo "</ul></li>"; } ?>
  10. Hi all, happy to have found ProcessWire a while ago - yet another MODX refugee - and glad to have discovered PocketGrid recently I now am looking for a simple responsive menu (pure CSS or CSS+jQuery) which nicely integrates with PocketGrid. (Something like the menu in Pure - but this depends on their own grid.) Any hints? To not forget: Kudos to Ryan and to the great community!
  11. Hello I'm totaly new to PW and for now I find it very understanding, all but navigations. I tried to find some videos or tutorials explaining about this but noting helpfull comes up. I read i most of the tutorials on the forum that I could find but stil cant find the right answer. I'm making my first template and need your help on how do I create a menu like this in WP. I'm not a coder ... but understand a little. <ul class="nav navbar-nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Home <i class="fa fa-angle-down"></i></a> <ul class="dropdown-menu"> <li><a href="index-1.html">Masonry</a></li> <li><a href="index-3.html">Masonry v1</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Pages <i class="fa fa-angle-down"></i></a> <ul class="dropdown-menu"> <li><a href="about-us.html">About Us</a></li> <li><a href="services.html">Services</a></li> </ul> </li> </ul> right now I'm here but it's not working right. <ul class="nav navbar-nav"> <?php $root = $pages->get("/"); function visit(Page $parent, $enter, $exit=null) { foreach ($parent->children() as $child) { call_user_func($enter, $child); if ($child->numChildren > 0) { visit($child, $enter, $exit); } if ($exit) { call_user_func($exit, $child); } } } visit( $pages->get(1) , function(Page $page) { echo '<li class="dropdown"><a href="' . $page->url . '" class="dropdown-toggle" data-toggle="dropdown">' . $page->title; if ($page->numChildren > 0) { echo '<ul class="dropdown-menu"> <li><a href="$page->url"></li> '; } else { echo '</a>'; } } , function(Page $page) { echo '</li>'; if ($page->numChildren > 0) { echo '</ul>'; } } ); ?> And I want my HOME page also to be shown. Any ideas? Thank you in advance R.
  12. In the $content .= renderNav($page->children) I was expecting a submenu like a dropdown but it's a. Now how do you make a dropdown menu using the Processwire way? Or just code like usual HTML5/CSS3 li, ul tags using "foreach ($page->children as" construct?
  13. I'm just having some trouble with my main menu, it's started happening all of a sudden across a few of my processwire sites (completely separate). I'm using MarkupSimpleNavigation to generate the menu. But when i look at the menu the Home (id 1) goes into the second position in the menu rather than the first. But when i login and check again, it's back to normal. The tree structure obviously has Home as the root. <?php $topMenu = $pages->find('id=1|1018|1026|1019|1020|1021|1023, sort=sort'); ?> <?php $treeMenu = $modules->get('MarkupSimpleNavigation'); $currentRoot = $page->rootParent(); echo $treeMenu->render( array('max_levels'=>1, 'parent_class'=>'parent', 'current_class' => 'current'), null, $topMenu ); ?> This is the code i'm using to generate the menu. Any help on this would be great. Thanks
  14. Hey there guys, Current situation: The page structure looks like this: Home ->About ->->Page 1 ->->Page 2 ->Test This structure comes back in the navbar menu. I'm using bootstrap as css/js framework. "About" is the visible container for the dropdown menu of Page 1 and Page 2. I click on About and then I see Page 1 and Page 2 which is great. What I would like to have is this: Home ->About ->Page 1 ->Page 2 ->Test and still have "About" as the visible container for Page 1 and Page 2 in the navbar so it acts like it's parent (without being an actual parent). Is there any way in processwire to have such parent page without an actual page? To get the bootstrap navbar working with the processwire page structure I was following this tutorial http://wiki.processwire.com/index.php/Bootstrap_Navbar
  15. Hello, i want to create two custom menus on my website and want to have option to add some pages in one menu and some in second page. i have created one template called top-menu this template is using repeater name "menu_pages" for page, so that i can add as many pages i want. filed name in repeater is "menu_page" after that i am calling that page in my template like that <ul class="sf-menu "> <li class="current active"><a href="<?=$config->urls->root;?>">Home</a></li> <?php $top_menu=$pages->get("/top-menu/"); foreach($top_menu->menu_pages as $menu_page) { ?> <li class=""><a href="<?php echo $menu_page->url ;?>"><?php echo $menu_page->page-tile ;?></a></li> <?php } ?> </ul> but i am getting output Home | 0 | 0 | 0 also i want to check if page have child pages then again sub menu will be created every time page have child page. i can't figure out how to do that. i saw few plugins but i want to write it myself. Thanks
  16. It struck me today, as I was working on a large site, that it would be really nice if the Setup -> Fields fly-out menu would implement the "Tags" feature to group fields into sub-menus. I use Tags (defined under the 'Advanced' tab when editing a field) to neatly organize fields on the actual Setup->Fields page. It would be great if the menu was also organized the same way. A single fly-out menu of 50+ un-grouped fields isn't so useful... What do you think?
  17. Hello there! I have a question regarding the "renderNav" function used in the ‘intermediate’ site-profile. I have a multi-level menu system going by using the renderNav function, and I’d like to extend the default "renderNav" function to also mark all the parents of any given page with "current". I think I have to modify this line from the "renderNav" function: $out .= $item->id == wire('page')->id ? "<li class='current'>" : "<li>"; … specifically adding something along the lines of foreach parent of the itemid "<li class='current'>" else "<li>", but is there a neat way of putting that into the existing line? Or how would you do it? Thanks!
  18. Hi, I have a frontend menu which is built using pages and a page select; it is output using a function that cycles through the pages and creates the menu; for this menu I wanted to also have the ability to select on some menu items which roles can see those items; I made a new field called menu_roles which selects the role; I didn't use built in roles field because it is permanent and i couldn't get rid of it off one of my templates once i added it. When i'm cycling through the pages, i'm using this to check if the current user should see the menu: $menuVis = true; if($child->menu_roles->count()) { foreach($child->menu_roles as $cmr) { $menuVis = true; $cmrRole = wire('roles')->get("$cmr->name"); if (!wire("user")->hasRole("$cmrRole") ) $menuVis = false; } } if($menuVis == false) continue; Edit: this sort of doesn't work... i can't figure out how to check multiple roles against a user at once, to get the visibility variable to be correct...Aarrgh! logic
  19. I need to outsource some navigation / menu work. If you are interested, please PM me and I can send you full requirements Basically, I need to outsource A 2-level drop down menu First level of links should be determined by the Page Field. 2nd level are just child pages Incorporate the drop down menu into http://www.meantheme...ugins/meanmenu/ I can handle the styling. Really need someone to just create the mechanism, simple CSS and PHP, This is a paid job. Thanks
  20. Hello ProcessWire community, I'm brand new to this great CMS and used to work before with Joomla. I'm trying to understand more and more how ProcessWire works as I actually realize an project with it. I'm not an developer an my skills are yet restricted - I'm still learning . So far I'm doing fine until I sumbled over the navigation... I searcherd and read a lot here in the forum but I guess it would be great if someone could give an idea, the right path or a solution for what I need to realize: - Home (only an menu-icon) -> on click the next children show (got that done with a little jquery) - Child 1 - Sub-Child 1 - Sub-Child 2 - Sub-Child 3 - Child 2 - Child 3 ... -> Now, on mouseover of an child, I need the Sub-Children to show up -> toggle - Child 1 will swap to Sub-Child 1, Sub-Child 2, Sub-Child 3) but the main link remains still to parent (Child 1). Any help or ideas are very appreciated. Regards, Bacelo
  21. My second PW site, theanodyne.com, features info for a local bar & pool hall and is designed to look like a vintage menu. They love how easy it is to update the site.
  22. Hello, I am trying to set up a multi-level menu in nested unordered lists. Specifically, I want to get pages from the first three levels in the page hierarchy. Since the page structure is somewhat complex and I wanted it to be flexible in the future, I added a checkbox field named "in_main_menu" that I can then use as a selector, in case some pages should not appear in the menu. The top level menu was easy: $main_menu = $pages->find('parent=/, in_main_menu=1, sort=sort, limit=7'); Then, as I was thinking through how to set up the nested navigation under each main menu item, I was thinking a "maximum depth" selector would be handy. Return all pages matching this selector that are no more than 3 levels deep in the hierarchy. I could not find a way to do that with selectors, though. I believe such a method would not return the pages in the exact order I want, anyway. My next thought was that I can just perform a find that returns all pages with in_main_menu, then process the results and build an array in the desired format. I'm not totally sure how that processing would work; I think it would be a bit complicated. Rather than dive into that . . . my final attempt (before posting now ) was to loop through the main menu pages and call children() on each of those. Then repeat for the third level. This seems to work, except for the third level, where I get an error. # loop: main menu pages foreach ( $main_menu as $main ) { // output top-level menu item # if: secondary menu if ( $secondary_menu = $main->children('in_main_menu=1') ) { # loop: secondary menu pages foreach ( $secondary_menu as $second ) { // output second-level menu item # if: tertiary menu if ( $tertiary_menu = $second->children('in_main_menu=1') ) { # loop: tertiary menu pages foreach ( $tertiary_menu as $third ) { // output third-level menu item } # end loop: tertiary menu pages } # end if: tertiary menu } # end loop: secondary menu pages } # end if: secondary menu } # end loop: main menu pages And it looks like this will work! My question, though, is whether I'm overlooking a simpler method. I would welcome your feedback. I realize I could abstract my code into a function (that would also allow N-levels), but I'm curious if there's even easier ways with the PW API.
  23. Recently I've been working on a site where it seemed like it was going to be impossible to keep the page tree and the needs of the site's main menu in harmony; So to solve this I setup a separate page tree under a hidden page called 'Main Menu', with each menu item having three fields: title, menu-link-page, and menu-link-url. All of the menu items are also hidden, so the code below uses the include=all parameter when getting the pages for the tree. To generate the main menu markup, i adapted the great code that was developed by Soma for Joss's bootstrap menu, and modified it to output links to the menu-link-page or menu-link-url; (Entering a value in the menu-link-url field overrides any selection in the menu-link-page.) This solution has enabled me to setup the menu exactly how the site needs it, even if the menu heirarchy is not the same as the page heirarchy, and has solved a lot of problems and made things easier for this scenario. For example, menu items can easily contain external URLs, to subdomain pages, or other related site's pages. (In this case the client has a separate web store for selling parts). Also, all of the parent menu items had to use a javascript:void() as the href, in order for the accordion version to work right on mobile; So this was easy to do by putting that into the menu-item-link field. In the code below, page #1271 contains the menu tree, so it is specified as a parameter to the $root variable. I think this sort of setup, using a custom menu tree, could solve a lot of the questions I've seen recently on the forum; I probably wouldn't use this technique on small sites since it is more work, but for larger ones where you might need a lot of menus, this could be helpful. Also, if you had to setup a Mega Menu, with images and icons, this might make it easier to manage. <?php /** * render custom markup menu for bootstrap nested navigation * * @param PageArray $pa pages of the top level items * @param Page $root root page optional, if you use other root than home page (id:1) * @param string $output for returned string collection * @param integer $level internally used to count levels * @return string menu html string */ function renderChildrenOf($pa, $root = null, $output = '', $level = 0) { if(!$root) $root = wire("pages")->get(1); $output = ''; $level++; foreach($pa as $child) { $class = ''; $has_children = count($child->children('include=all')) ? true : false; if($has_children && $child !== $root) { if($level == 1){ $class .= 'parent'; // first level boostrap dropdown li class //$atoggle .= ' class="dropdown-toggle" data-toggle="dropdown"'; // first level anchor attributes } } // make the current page and only its first level parent have an active class if($child->menu_item_page === wire("page")){ $class .= ' active'; } else if($level == 1 && $child !== $root){ if($child->menu_item_page === wire("page")->rootParent || wire("page")->parents->has($child)){ $class .= ' active'; } } $class = strlen($class) ? " class='".trim($class)."'" : ''; if($child->menu_item_url) {$childlink = $child->menu_item_url; } else { $childlink = $child->menu_item_page->url; } $output .= "<li$class><a href='$childlink'>$child->title</a>"; // If this child is itself a parent and not the root page, then render its children in their own menu too... if($has_children && $child !== $root) { $output .= renderChildrenOf($child->children('include=all'), $root, $output, $level); } $output .= '</li>'; } $outerclass = ($level == 1) ? "accordmobile" : ''; return "<ul class='$outerclass'>$output</ul>"; } // bundle up the first level pages and prepend the root home page // $root = $pages->get(1); // $pa = $root->children; // $pa = $pa->prepend($root); // Set the ball rolling... // echo renderChildrenOf($pa); // example with pages further down in the tree $root = $pages->get("1271"); $pa = $root->children('include=all'); // $pa = $pa->prepend($root); // add the root as the second parameter echo renderChildrenOf($pa,$root);
  24. If I go into the Processwire admin and select 'Home->Chidren' I'm presented with a list of pages underneath home. The 'sort settings' sections has a set of instructions that reads "Leave the sort field blank if you want to be able to drag-n-drop to your own order." Unfortunately, there is no way to make the drop down blank, and that's also somewhat counterintuitive since Drag-n-drop as an option makes perfect sense. In any event, none of the pages are draggable in order to sort them—are they draggable somewhere else in the admin?
  25. Greetings all, I am trying to separate which pages display on the header menu and those which appear on footer menu. For that I created two checkbox fields, applied them to the templates, and now I am trying to filter them in the menu list. Here's my code: <?php [b]$homepage = $pages->get("/")->find("visibility_in_top_menu=1");[/b] $children = $homepage->children; // $children->prepend($homepage); $i = count($children)-1; foreach($children as $child) { $class = $child === $page->rootParent ? " class='on'" : ''; if($i>0){echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>";} else {echo "<li><a$class href='{$child->url}' id='last'>{$child->title}</a></li>";} $i-=1; } ?> The thing is that I am probably not setting up the first line well. Can anybody help me out? Thanks!
  • Create New...