Welcome Guest, Not a member yet? Register   Sign In
Tatter\Menus basics
#1

I am trying to use Tatter\Menus and have some very basic questions. I installed Tatter\Menus via Composer at /vendor/tatter and can't figure out how to get the example menu working, MainMenu.php.

Where should I put MainMenu.php - in app/Views? Or somewhere else?

Documentation says "Since Menu is Stringable it can be used in your view or layout files as is. ".   If I create a view (eg, TatterExampleView.php), I don't understand how to access MainMenu in the view file to display the menu? I looked at the Spatie page to see if it had any additional guidance and did not see anything.

I really appreciate the work that was done to provide this library.

Code:
<? php
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();
  }
}
Reply


Messages In This Thread
Tatter\Menus basics - by dm1 - 12-26-2021, 08:31 AM
RE: Tatter\Menus basics - by kenjis - 12-26-2021, 05:06 PM
RE: Tatter\Menus basics - by dm1 - 12-27-2021, 04:07 AM
RE: Tatter\Menus basics - by kenjis - 12-27-2021, 05:21 PM
RE: Tatter\Menus basics - by dm1 - 12-28-2021, 03:15 PM
RE: Tatter\Menus basics - by kenjis - 12-28-2021, 06:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB