Skip to content

dtjngl/MenuAllocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Menu Allocator Module for ProcessWire

The Menu Allocator module is a ProcessWire module that allows you to allocate menus to pages in your ProcessWire CMS installation. You can define menus and assign them to pages, making it easy to manage page navigation and menus in your site.

Installation

  1. Download the module's ZIP file from the GitHub repository.
  2. Extract the ZIP file and place the MenuAllocator directory into your ProcessWire site's /site/modules/ directory.
  3. In the ProcessWire admin, go to Modules > Refresh.
  4. Find the "Menu Allocator" module in the modules list and click the "Install" button.

Configuration

After installation, you can configure the module settings:

  1. Go to Modules > Configure > Menu Allocator.
  2. Define your menus by entering menu names, separated by spaces. For example: topmenu mainmenu footermenu
  3. Save your changes.

Usage

Allocating Menus to Pages

  1. Edit a page in the ProcessWire admin.
  2. In the page editor, you'll see a "Menus" section where you can select the menus for that page.
  3. Choose the menus you want to allocate to the page.
  4. Save the page.

Retrieving Menu Pages

You can retrieve pages associated with a specific menu using the getPageArray method provided by the module:

// Example usage to retrieve pages associated with the 'top' menu
$topMenuPages = $modules->get('MenuAllocator')->getPageArray('top');

// Example usage to retrieve pages associated with the 'footer' menu
$footerMenuPages = $modules->get('MenuAllocator')->getPageArray('footer');

// Now $topMenuPages and $footerMenuPages contain arrays of pages associated with the respective menus

// Example: Display the 'top' menu
echo '<ul>';
foreach ($topMenuPages as $page) {
    echo '<li><a href="' . $page->url . '">' . $page->title . '</a></li>';
}
echo '</ul>';

// Example: Display the 'footer' menu
echo '<ul>';
foreach ($footerMenuPages as $page) {
    echo '<li><a href="' . $page->url . '">' . $page->title . '</a></li>';
}
echo '</ul>';

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages