Welcome Guest, Not a member yet? Register   Sign In
Dynamic Menus & Breadcrumbs
#1

Hello all! This module has actually been out for a little bit but as a prerelease, making sure I got the kinks worked out. I release 1.0 this week, so I'm happy to share:
Tatter\Menus
Dynamic Menus for CodeIgniter 4
Built on top of Spatie\Menu, Menus provides dynamic menus across your application. Menus organizes and injects the menu content, so you can focus on building. Here's an example menu:
PHP Code:
class MainMenu extends \Tatter\Menus\Menu
{
 public function 
__toString(): string
 
{
 return 
$this->builder
 
->link(site_url('/'), 'Home')
 ->
link(site_url('/about'), 'About')
 ->
html('<hr>')
 ->
link(site_url('/contact'), 'Contact')
 ->
render();
 }

Once you have defined your menu(s), add the placeholder to your view layout and the Filter will build it in place:
PHP Code:
<html>
 <
body>
 {{
main}}
 <
h1>Fruit Shop</h1>
 {{
fruit}}
... 
Menus will automatically set "active" classes based on the detected route. Styling can be applied by one fo the prebuilt stylers (AdminLTE, Bootstrap, Breadcrumb), or supply your own. Use the config file to define as many menus as you like!
In addition to building your own menus, you can use one of the autodetecting menus:
  • Breadcrumbs: The BreadcrumbsMenu is a special menu, using horizontal-style navigation links for nested content. This menu comes pre-styled for Bootstrap and defaults to the segments retrieved from the current URI (but you may also provide your own).
  • Controller (coming soon): This menu uses your project's Controllers to build CRUD-like menu options for each resource.
Check out more in the docs.
As always, I welcome any feedback, feature requests, suggestions, bug reports, or high-fives. Leave a note here or create an Issue on GitHub for bugs and feature requests.
Reply
#2

[quote pid="387747" dateline="1624023998"]
Hi MGatner, you say in your post that you built this on top of spatie / menu. Does that mean you added/modified some functionality, or did you have to wrap it so that it will integrate easily with CI4?
[/quote]
Reply
#3

Thank you, @MGatner
Reply




Theme © iAndrew 2016 - Forum software by © MyBB