Jump to content

renobird

PW-Moderators
  • Posts

    1,699
  • Joined

  • Last visited

  • Days Won

    14

Everything posted by renobird

  1. That explains why it didn't work for me either with FB.
  2. The commits to the dev branch are always very solid and stable. I've used the dev branch for several production sites in the past, but fully realizing I do this at my own peril. I've never experienced an issue that caused me to revert to the master branch. However, I do try to stick with the current master for most production sites. Upgrading is super simple. As of 2.5.3 (the current master) you can upgrade/downgrade/DB backup from within the admin.
  3. I'll try again with a fresh install and see if I can recreate it.
  4. Do you have the default admin theme set in config.php, or just on a per user basis? I can't recreate this. I've tried all the scenarios.
  5. I can confirm this on PW 2.5.3 as well.
  6. Did you turn off the trailing slashes for those templates?
  7. The caveat here is that new pages won't be immediately added to the menu because of the markupCache. It's just cleared at the interval, not via page save. I haven't ever looked into it, but it might be possible to clear the markupCache from a hook.
  8. very strange. I'll see if I can recreate that here.
  9. I needed a break from a project I was stumped on, so here's a version that creates a bootstrap menu (at least the best I can tell, since I don't use bootstrap, I just went by your sample code). I stripped out a few of the things to make it more general, but you could easily use it to create your menu. Renders lightning fast here. <?php function navList($items, $level = 1){ $max_levels = 2; $level == 1 ? $attrs = 'class="nav navbar-nav navbar-right"' : $attrs = 'class="dropdown-menu" role="menu"'; $out = ''; if ($level <= $max_levels){ $out = "<ul $attrs'>"; foreach ($items as $item){ $out .= navItem($item, $level); } $out .= "</ul>"; } $level++; // increment level each time this function is called. return $out; } function navItem($item, $level){ $url = $item->url; $attrs = ''; $itemClass = 'nodropdown'; if ($item->template == "redirect"){ if (trim($item->redirect) == "") return; // skip because the field is blank. $url = $item->redirect; if($item->new_window == 1){ $attr = "target=_blank "; } } if ($item->numChildren()){ $itemClass = 'dropdown'; $attrs = 'class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" '; } $out = "<li class='$itemClass'><a href='$url' $attrs>$item->title</a>"; if ($item->numChildren > 0){ $out .= navList($item->children(), $level + 1); // get recursive } $out .= "</li>"; return $out; } ?> <nav class="navbar navbar-fixed-top" role="navigation"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="<?=$config->urls->root;?>"><img src="" class="Logo" alt="Logo" /></a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="navbar-collapse-1"> <?php $cache = $modules->get("MarkupCache"); if(!$data = $cache->get("main-nav")) { $data = navList($pages->get("/")->children()); $cache->save($data); } echo $data; ?> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav>
  10. MarkupCache clears at a default interval of an hour, but you can specify less time if you want. $cache->get("menu-test",120); // 2 minutes No worries, I suspect it will be useful to someone else as well, so I figured I'd leave a solid example here.
  11. I just quickly built a menu using: $navItems = $pages->get("/")->children("template!=syllabi"); That creates a 2 level menu with 15 parents, and about 65 children. Without any markupCache total time: 0.6733 With MarkupCache total time: 0.0018 I tested them like so: $t = Debug::timer(); echo navList($p); echo Debug::timer($t); $t = Debug::timer(); $cache = $modules->get("MarkupCache"); if(!$data = $cache->get("menu-test")) { $data = navList($p); $cache->save($data); } echo $data; echo Debug::timer($t);
  12. OK, I tested the code above and it works as expected.
  13. You can restrict it to one level, or you can also do $item->children($selector) to filter out certain template types. If you use markup cache for your menus, then it won't matter, the slowdown will be minor for the one view that retriggers the cache. That said, whatever works for you. I like to keep these things as dry as possible.
  14. You've checked all the obvious things like the page being hidden or unpublished I assume — and the page is actually visible on the site? What happens if you change the title, will the new title show in the search?
  15. I was thinking about launching a new CRM and calling it Vista — I don't see the problem.
  16. I changed the "solved" answer on this post, because I think the code above is a lot more universal.
  17. Here's a more complete answer. Tested and works as expected. function navList($items, $level = 1){ $max_levels = 2; $level == 1 ? $class = "parent" : $class = "child"; $out = ''; if ($level <= $max_levels){ $out = "<ul class='$class'>"; foreach ($items as $item){ $out .= navItem($item, $level); } $out .= "</ul>"; } $level++; // increment level each time this function is called. return $out; } function navItem($item, $level){ $url = $item->url; $attr = ''; if ($item->template == "redirect"){ if (trim($item->redirect) == "") return; // skip because the field is blank. $url = $item->redirect; if($item->new_window == 1){ $attr = "target=_blank"; } } $out = "<li><a href='$url' $attr>$item->title</a>"; if ($item->numChildren > 0){ $out .= navList($item->children(), $level + 1); // get recursive } $out .= "</li>"; return $out; } echo navList($p); No need to do anything other than get the top level nav items and set the $max_levels if different than 2. You can of course probably do all of this as easy/easier with MarkupSimpleNavigation, but it's not necessary if all you need is this.
  18. You should really check if the redirect field is empty, and if it is, then skip that page.
  19. Written in browser, but something like: foreach ($TopLevelNavLinks as $p){ $url = $p->url; $title = $p->title; $attr = ''; if ($p->template == "redirect"){ $url = $p->redirect //redirect is the name of the URL field if($p->new_window == 1){ $attr = "target=blank"; } } echo "<li><a href='$url' $attr>$title</a></li>";
  20. I'm not sure I follow. If you have a "redirect" template with 2 fields: URL, New Window Each page that is just a redirect would use that template. So then you can change the output based on template and the value of the checkbox.
  21. Add the new window checkbox to your template. If "new_window" = 1 add "target=blank" to your <a> tag on output.
  22. What are you using to generate the navigation? custom code, or MarkupSimpleNavigation?
  23. I can confirm this here. I've always set $c->status = 1, so I never noticed that it's not actually working correctly. Looking at comment.php, I thought perhaps setting $c->status = $c->statusSpam might do it, but still saves as 1 in the DB.
  24. Does the status change to something other than 1 if you change the moderation settings for the field?
×
×
  • Create New...