Soma

Moderators
  • Content count

    6,561
  • Joined

  • Last visited

  • Days Won

    152

Soma last won the day on June 30 2016

Soma had the most liked content!

Community Reputation

6,139 Excellent

1 Follower

About Soma

  • Rank
    Dreamer
  • Birthday 03/31/1975

Contact Methods

  • Website URL
    http://soma.urlich.ch

Profile Information

  • Gender
    Male
  • Location
    SH, Switzerland

Recent Profile Visitors

34,669 profile views
  1. 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.+.
  2. 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); }
  3. 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...
  4. 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.
  5. 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
  6. 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.
  7. @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?
  8. 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.
  9. @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) ...
  10. @PlayOverwatch Did you know you can autolock doomfist on PC when pressing Alt + F4.

  11. Maybe party_type is multiple instead of single page select?
  12. 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)
  13. 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.
  14. Why do u use big letter in url? No good.