Roots Discourse

Sage10 Mobile Menu Set-up Questions

Hello there. I’ve built two projects with Sage10 so far but always using Bootstrap and looking to make the jump over to Tailwind.

One thing I can’t figure out is what everybody is using for menus and in particular, responsive mobile menus.

I know there there are several bootstrap navwalker’s but I can’t seem to find a similar item for Tailwind.

Any help you have in pointing me in the right direction for either sample code or a tutorial to help get that part started would be greatly appreciated.

Cheers,
David J.

1 Like

Thanks for the lead. I got the code installed the same as your example for sage10 and I called the blade navigation template using @include(‘partials.navigation’)

The problem is that I’m getting an error:

Uncaught ReflectionException: Class navi does not exist in /Volumes/Drive 1/Sites/sage10.test/app/public/wp-content/themes/sage10/vendor/illuminate/container/Container.php on line 879

I’m just not sure where to drop in the suggested basic usage code:

<?php

use Log1x\Navi\Navi;

$navigation = (new Navi())->build('primary_navigation');

if ($navigation->isEmpty()) {
  return;
}

return $navigation->toArray();

Thanks for any tips you can provide.

you can ignore the basic suggested code as its in the sage-10 example already.

did you install navi as a plugin or in your theme?

Sorry for the delay. Yes, I installed it using composer.

I’m trying to use this on a Sage 9 site. I’ve included it with composer and have copied the code/files from the Sage 9 examples.

I’m getting a " syntax error unexpected → (T_OBJECT_OPERATOR), expecting ‘;’" error on this line
return new Navi()->build('primary_navigation');

Any advice? Thanks

Read the error. You can’t chain directly off a new statement, you have to chain off an object:

(new Navi)->build();
// or
$navi = new Navi;
$navi->build();
1 Like

doh yeah of course. Thanks, was just surprised that the given code wan’t working