Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. Nope, a name wouldn't be unique throughout the system. I don't see a problem at all to see the page ID.
  2. Oh, it's a theme issue? Sorry, never used other AdminTheme.
  3. Via the "Logout" ?
  4. But what happens with the normal users? Can normal users view the page "/events/" ? Is the url correct? Can you get the url by API instead?
  5. I meant there is in the example if you remove the <ul> from the options, it would results in <ul><div><li>...</li></div></ul>, not saying bootstrap has. I tried with a special hook to remove the <li>' on the level greater than 1. Does that work for you? $nav = $modules->get('MarkupSimpleNavigation'); $options = array( 'has_children_class' => 'dropdown', 'list_tpl' => '<li%s>||</li>', 'current_class' => 'active', 'list_field_class' => 'nav-item', 'max_levels' => 2, 'item_tpl' => '<a class="nav-link gek-anim" href="{url}">{title}</a>', 'outer_tpl' => '<ul class="navbar-nav ml-auto">||</ul>', 'inner_tpl' => '<div class="dropdown-menu">||</div>', 'item_current_tpl' => '<a class="nav-link active" href="{url}">{title}</a>', ); $nav->addHookBefore("getListString", null, function($event){ $msn = $event->object; if($msn->iteration > 1){ // on level 2 and greater $msn->list_tpl = array("",""); } else { $msn->list_tpl = array("<li%s>","</li>"); } }); $sidebar .= $nav->render($options);
  6. You don't want to remove the || placeholder used to render the entries. Edit: Ah I see, there's a problem of <li>'s inside a <div> within a UL isn't valid HTML and Browsers moves them out of the <div>. Unfortunately there's not way to render such a thing in MSN. Bootstrap is really strange... why can't they just have normal nested UL's...
  7. Maybe remove the <ul></ul> from your options "inner_tpl" code then?
  8. I wonder why you need something like this in the first place "to have at least one date". wire()->addHookBefore('Pages::trash', null, 'hookTrashDelete'); wire()->addHookBefore('Pages::delete', null, 'hookTrashDelete'); function hookTrashDelete($event) { $page = $event->arguments("page"); //prevent deletion of last child $preventTpls = [ 'single-date', 'single-event', 'single-business-vacation', 'single-special-business-hours' ]; if(in_array($page->template, $preventTpls)) { preventDeleteDateEntry($event, $page); } } function preventDeleteDateEntry($event, $page){ if($page->parent->numChildren() === 1) { $event->replace = true; // now original function won't be called wire()->warning(__("Deleting of the last date is not allowed. There must be at least 1 date.")); } else { wire()->message(__("1 date was deleted.")); } } I would code it like this. So the hook could be used for different things. Also some code formatting for better reading. Use $page->numChildren(), in case you have thousands/millions of children you'd get a server out of memory Don't use $event->return = error.
  9. https://processwire.com/api/ref/input/page-num/
  10. What's the difference? Pagetable are pages that are edited in the modal. Your screenshot in OP doesn't show a pagetable btw.
  11. I can't reproduce and it works flawless in pw2.7.2 float. Whether , or . PW handles it. Locale is important only for Date strings and Number formats. So unless you use strftime() to print "Montag, 1. April 2018" it can be ignored.
  12. Yes, you just have to make sure the hook doesn't loop into nirvana. That's one way yes, but maybe the ID isn't always there. It's not so much a problem that the hook get's called multiple times if you restrict it via the template or something else (ie a $this->skip flag you set to true) but maybe some code in there gets executed still, like your message idk. It depends a lot what you do and possibly trigger in your hook. I found myself often tracking and trying to figure out what's going wrong for hours and hours, which is not fun at all. Sometimes it's a side effect or even possibly a bug you never know.
  13. Well look into that translation to see the locale.
  14. I mean you hook into save and you create pages that you save triggering the hook again and again and again.
  15. It most likely the locale setting in the de language pack that affects numbers. There was once a fix I thought around that time.
  16. In my case this works all normal. Message is shown not matter what I do. But I wonder how your complete code looks like. For example you can't just create pages in a saveReady hook without handling the endless recursion you will get. It would give a 500 server error. Also creating and deleting pages could be something as the message session flash could get cleared out on something. My experience is once you get down that rabbit hole with lots of hooks on saved or especially saveReady it can get very hard to find the issue. Chances are we can't help you without having the whole thing and sitting in front. Edit: aka we don't even know what PW version you're using.
  17. ProCache, Apache *hugahuga*.
  18. We have it in use for years now on a very large site 400'000+ pages, no obvious issues so far.
  19. Yes is normal. _init.php the page is already rendering and the APi vars are extracted.
  20. I don't think you want to have 'show_root' => true, There's no root to show if you add a $entries PageArray. It's only for if you add 1 root page to the navigation options
  21. There's no option for this. There's some jquery code I posted to do this client side. https://processwire.com/talk/topic/1036-markupsimplenavigation/?page=22&tab=comments#comment-139794
  22. There's no image ID, but the page ID plus the image name are unique. Also you code example works fine. You could use a <img src="xxx/some.jpg" data-pageid="1001" data-imageid="some.jpg"> Then you know which page and image it is. $image = $pages->get(pageid)->images->get("name=imageid"); No need for extras fields or hooks.
  23. Template has to allow pagination not url segments, that two different things.
  24. If the name is the same on alternative languages, PW doesn't store it cause it's redundant data. The first code is wrong, as there's only "name" in a find selector not a "name[LANGID]". You don't need to handle the language as it's handled by the user language already. The second code needs a second param to be "true" to get the default name if the localized is empty. $page->localName($lang, true). /** * Add a Page::localName function with optional $language as argument * * event param Language|string|int|bool Optional language, or boolean true for behavior of 2nd argument. * event param bool Substitute default language page name when page name is not defined for requested language. * event return string Localized language name or blank if not set * * @param HookEvent $event * */
  25. Like with beard?
×
×
  • Create New...