Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. No theres nothing short except the xtemplates option.
  2. Hook to MarkupSimpleNavigation::getTagString to alter the item: Little more in the docs on the hook to alter the output of an item: https://github.com/somatonic/MarkupSimpleNavigation#hook-for-custom-item-string-new-in-120 If your top level pages use their own template you could easily use "xtemplates" options to render the items differently using the template you specify there.
  3. There's nothing special about it. Just as you normally would style a navigation. The module doesn't do that for you, it just outputs a nice clean nested UL, just a few classes for parents and active. https://www.smartmenus.org/docs/ Is a simple JS Script to generate dropdowns and also resposive. You can drop the smartmenu plugin with their CSS and mobile hamburger button as in the docs (further down) and add the id and class to the outer tpl <ul id="main-nav" class="..."> of MarkupSimpleNavigation and it works out of the box,
  4. There's a story from Richard WIlliams (Animators Survival Kit), asking Milt Kahl (greatest Animator who ever lived) if he also listens to classical music during work. Milt responded, that this is the most stupid question ever, and that he's too stupid to do more than one thing at a time. Richard became a better animator instantly not listening to music anymore. He educated many animators working on computer, very addicted to music, to stop it and they all improved in their work a lot. Since I stopped listening to music (which is hard at first) while programming or painting I noticed a lot of improvement in my work.
  5. Nothing different from PW2 to 3 really. This code is even in the default install themes and working normally.
  6. Thanks. I guess that's why the modules states it's compatible until PW 2.4. I have no plans to update the module for 3.+.
  7. Also as a side note. Not sure what the $this->redirectPage is but you don't need to pages->get() it when you compare the id anyway. Also if you have already an autoload module with ready() you could do it directly in there instead of a hook. $this->wire("page") being the page requested about to get rendered. public function ready() { $redirectPage = $this->wire("pages")->get(1001); if($this->wire("page") === $redirectPage) return; $this->wire("session")->redirect($redirectPage->url, false); }
  8. How about redirect to the url page->url not the page object which would be the id. Also i would use $this->wire ('pages')->... not $event->pages...
  9. Every request will create an entry, even ajax request in the background. So if you look at the log, it will poll it all couple seconds creating a new entry. Otherwise it's called once for every request, unless you have multiple instances. You shouldn't do something in the init other than setting properties, hooks or something. No resource heavy stuff if not needed.
  10. Soma

    Aligator

    Hey, thanks for the input. I was putting my head into it quite a few time yesterday, and messed up something. Took a while to figure it all out today. It can get complicated. You refactor stuff, then suddenly it all messed up. I commited a new version with some of your input and various fixes. https://github.com/somatonic/Aligator/commit/dc4d8aa19ff665e24aa07ccba65fd3aff0d4e002 The static level I also recognized that it gives problem when using more than one menu. Also the default options now carry over all levels. I don't think a "all" array is needed just for that, since it was the intention to have a default that is the fallback. I added a $states variable to callback (third argument) that returns a string with classes for the different states. You can enable it and configure it too. Something like this was my testing scenario: /** * load Alitgaor module * -------------------------------------------------------------------------------- */ $nav = $modules->Aligator; /** * first menu * using PageArray for first level and prepend root page * -------------------------------------------------------------------------------- */ $menuPages = new PageArray(); $home = $pages->get("/"); $menuPages->add($home->children("template=basic-page")); $menuPages->prepend($home); $nav->enableStates = true; // enable states ("parent current has_children first last") $nav->levels = 3; // set max levels to render // the default options for all levels $nav->setDefaultOptions(array( "selector" => "template=basic-page", "callback" => function($item, $level, $states){ // $states is a string of item state classes to insert somewhere $classes = $states ? " class='$states'" : ""; return array( "item" => "<a href='$item->url'>$item->title</a>", "listOpen" => "<li$classes>", "listClose" => "</li>", "wrapperOpen" => "<ul class='dropdown'>", "wrapperClose" => "</ul>", ); } ) ); // render the menu $content .= $nav->render($menuPages, array( array( // level1 "selector" => "template=basic-page", ), array( // level2 "selector" => "template=basic-page|article" ) )); /** * render different menu with default options and using a root page * -------------------------------------------------------------------------------- */ $nav->levels = 4; $nav->collapsed = true; $nav->setDefaultStates(array("is_current" => "active")); $nav->setDefaultOptions(array( "selector" => "template=basic-page", "callback" => function($item, $level, $states){ return array( "item" => "<a href='$item->url'>$item->title</a>", "listOpen" => "<li class='$states'>", "listClose" => "</li>", "wrapperOpen" => "<ol>", "wrapperClose" => "</ol>" ); } ) ); $content .= $nav->render($pages->get("/")); I'm not sure, there's possibly still something that isn't covered or I missed but seems working fine here. Thanks
  11. Soma

    Aligator

    Had to look more at it again. No there's no such built in option. But there's some ways to do it. The first argument not only works with a root page but also with a PageArray. So you could do build a PageArray, add children of root, then prepend the home page to it and send that to Aligator. All you need to make sure you don't render level2 of home page which would render your menu again if home is your root. Got it? $menuPages = new PageArray(); $home = $pages->get("/"); $menuPages->add($home->children()); $menuPages->prepend($home); $content .= $modules->Aligator->render($menuPages, array( array( // level1 "selector" => "" ), array( // level2 : don't render the children of "home" "selector" => "parent!=1" ) ), 3); Or a more straight forward version is to use the wrapperOpen and add it manually. $homeUrl = $pages->get(1)->url; $nav = $modules->Aligator->render($pages->get(1), array( array( // level1 "selector" => "", "callback" => function($item, $level) use($homeUrl){ return array( "wrapperOpen" => "<ul><li><a href='$homeUrl'>Home</a></li>", ); } ) ), 3); The first last class thingy is not something I really ever use, but if it works for your navigation then it's ok to do it that way. It's just you would be careful if there's lots of pages as siblings. You'd also want to use the same selector you use for the level. Otherwise it would not work as the last sibling might be not rendered as by the selector.
  12. @SwimToWin I don't think I can help you on this as I have no time and no interest in maintaining bootstrap navigations. The module isn't made for it anyway. Maybe someone else who uses bootstrap stuff can help you out?
  13. This is correct and I do that as well, just only works to add something at the end. I assumed he want to add to a end of a pulldown.
  14. @billjoseph I think what need to do is simply test if it is the last child of its parent. $parent = $child->parent; if($parent->children->last === $child) ...
  15. @PlayOverwatch Did you know you can autolock doomfist on PC when pressing Alt + F4.

  16. Maybe party_type is multiple instead of single page select?
  17. https://processwire.com/api/ref/field/get-label/
  18. I just tried and changed my setup to a pw27.info and pw27b.info and its working fine. I don't see any reason why domain name would make a difference. I even uninstalled languages support to rule that out. I also don't know which PW version we are talking about. Also 404 page of server or PW? The config is correct and works here. Also config root name doesn't have to be the domain it could be "foo" or "bar". Only thing I can imagine is if you have a folder called "page1" in your install that would conflict with PW (nothing to do with multisite)
  19. 0.1.0 is the correct version I recommend. I'm not sure, looks correct except you have config "domain1.net" but you access the site with www.domain1.net? It should match I think.
  20. Why do u use big letter in url? No good.
  21. Just because the user is logged in doesn't mean he has view/edit access to the user page. The user template is secured and inherit access from admin template.
  22. I?m not sure I understand the problem. The "News" entry has a class "active" as it should, but it doesn't show the children as they're hidden dropdown. Seems more like a problem with your html css js.
  23. Not sure why you need to rewrite it. Current last version is the essence of 2-3 experience using it. Just wanted to mention that for good reasons the module doesnt hook page path anymore cause it creates all sort of problem with core and other modules. Also id based root isnt tranportable thats why i have done it via config and page names. Good luck.
  24. Ah yes. No problem, I found the issue. My older Multisite module, which was hooking and altering page paths is the problem. Thats why I removed it from Multisite.
  25. I'm just trying the module. Thanks for the awesome tool. I tried to import the files.zip with edit imported content option after, but after some time I get a error "Missing required ZIP or JSON Source" and nothing has changed. After trying again without the option to edit, the pages are all flat imported under home instead of creating the structure. Edit: Every page in the json has: parent_name: "/"
×
×
  • Create New...