Jump to content

Macrura

PW-Moderators
  • Posts

    2,765
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. to answer mrkhan's query regarding the way my setup for this example is, here is the screenshot of the table that generates the menu: @clsource - your example is also the same as what is discussed in depth in my last link provided in my prior post; which has the same features/setup. Visitors looking at this thread may want to visit that topic because it also provides the comprehensive code to output the markup for such a setup.
  2. my setup and that function is really only for simple sites needing only 2 levels; also for the way i have it setup i'm using a table, but it should work with any wirearray. in your case it seems that you may be better off using MSN, or Menu builder, or even a separate branch of the page tree which can generate an MSN menu but specifying a root page argument, and then overriding the URL to be the page select instead of the virtual menu page/node. there are a lot of posts on this forum with recursive functions for making menus of all kinds, from all different types of sources, be it the page tree, a menu tree, or repeaters; here are some: https://processwire.com/talk/topic/9033-mega-menu/?hl=%2Bnested+%2Bmenu#entry87159 https://processwire.com/talk/topic/8544-want-to-create-a-custom-menu/?hl=%2Bnested+%2Bmenu#entry82687 https://processwire.com/talk/topic/3650-multi-level-menu/?hl=%2Bnested+%2Bmenu https://processwire.com/talk/topic/2787-custom-menu-not-related-to-page-tree/?hl=%2Bnested+%2Bmenu
  3. sure - here's the function - you'd need to have fields for menu_group (checkbox), menu_page (page select) and menu_href (url) which overrides page select; in this case you also need to set the href as a # for the parent items, but you could change this probably function semanticNav($field) { $page = wire('page'); $menu = $field; $out = ''; $group = false; foreach($menu as $item) { $class = ''; // if this item is not in a group, but group is true from previous // item, close the ul /li now: if($item->menu_group != 1 && $group) $out .= "</ul>\n</li>\n"; $url = ''; if($item->menu_page->id) $url = $item->menu_page->url; if($item->menu_href) $url = $item->menu_href; if($item->menu_page->id == $page->rootParent->id) $class = " class='current'"; if($item->menu_group == 1 && $item->menu_href == '#') { $out .= "<li class=\"dropdown\">\n"; $out .= "\t<a href='#' class='dropdown-toggle' data-toggle='dropdown'>$item->menu_title</a>\n"; $out .= "\t\t<ul class=\"dropdown-menu\">\n"; $group = true; } // Sub items if($item->menu_group == 1 && $item->menu_page->id) { $out .= "\t<li{$class}><a href='$url'>$item->menu_title</a></li>\n"; $group = true; } // Regular Items: if($item->menu_group != 1 && $item->menu_page->id) { $out .= "\t<li{$class}><a href='$url'>$item->menu_title</a></li>\n"; $group = false; } } return $out; }
  4. yes, sometimes for simple sites i do something like this (usually use a table, but repeater should work); i'm not sure about depth - seems maybe unnecessary; i usually have a checkbox called child which simply makes the current row/repeater a child of the previous non-child item in the order that the items appear in... also i think you can maybe use this shorter ternary syntax if you are using the code above $prev = $item->prev->depth ?: 0; $next = $item->next->depth ?: 0;
  5. FYI i simply copied the stock module from 2.7 and then swapped out the js file, added the css; i didn't try and use the module from devns, though i'm not sure if that matters; the assumption is that eventually the new version of the datetime field would allow you to configure the settings, e.g. sliders vs. selects. also i have not tested this with form builder, and since your post is in general support, the assumption is that this relates to the stock admin; for formbuilder support i would recommend posting in that private forum.
  6. i'm using the updated timepicker and it works fine so far - you would want to duplicate the inputfield (datetime) into your site directory and then tell PW to use that one; from there you can make your changes... (like to the CSS file) you may also need to add something like this to your admin custom files (ProcessPageEdit.js) if(typeof $.timepicker != 'undefined') { $(function(){ $.timepicker.custom = { stepMinute: 15, controlType: 'select', oneLine: true, }; $.timepicker.setDefaults($.timepicker.custom); }); } word is that the next version of PW will have the updated timepicker addon
  7. some of these might be applicable: https://processwire.com/talk/topic/9486-movie-website-session-times-by-day/ https://processwire.com/talk/topic/4991-sub-arrays-dates-times-and-pure-hell/ also sometimes i avoid having to use the array_unique by using the value as the key
  8. yeah, like this insanity: https://developer.joomla.org/security-centre/630-20151214-core-remote-code-execution-vulnerability.html
  9. the page tree is hidden, you can go find the page under admin, and unlock it, then un-hide it; i'm not sure why it is hidden by default, but once you un-hide it i think it should stay un-hidden.
  10. it might work, but you could also try page table - might be a little cleaner UI
  11. awesome, many thanks for this! will be upgrading mods tomorrow...
  12. can you post your version; i'm assuming this is a fresh install and you are running the minimum requirements for Apache, MySQL and PHP?
  13. In relation to lister - So i have this module generating a dynamic link (the link is based off the combination of a page select and some attributes of the page being edited); to get it to work in lister, e.g. where it doesn't end up getting entity encoded, i added this to ready.php: wire()->addHookAfter('FieldtypeRuntimeMarkup::markupValue', function($event) { $value = $event->arguments('value'); $event->return = $value; }); should the module assume that the output will be markup and therefore also provide a markupValue by default, or leave this up to the user to add as a hook?
  14. @Martijn - thanks - that's very cool. I like the idea of the label - so i'm going to see about integrating your version into my current project's settings table... It is definitely more user friendly to have the label - some clients put wrong stuff into value because they only see the variable name and sort of don't get it. Also in newer versions of my settings i have an options column, which inside i can place pipe-delimited options, such as enabled|disabled, or true|false, or on|off; then in the value row, when you click into the cell, it brings up a select; this helps to control the spelling and to also remind people of what sort of values are acceptable for the field. To achieve this i'm using a commercial jQuery plugin called Pickle, which lets you create a select out of any text input;(if i could find a non-commercial plugin that did the same thing i would post the instructions here)
  15. @kongondo - thanks - yes, i could also just delete and remake the field, since i can copy the code, and there is no risk of losing entered data... it would be good to fix though, as surely someone along the way is going to try and rename one of these..
  16. @kongondo - wondering if there might be an issue with renaming fields using this fieldtype; i tried renaming an existing field but got a sql error;
  17. great - i was planning a write up/tutorial on various ways to do menus on PW; historically i've done it using a lot of different ways (besides the usual generating from the page tree); for some simple sites now i use a profields table, now that it supports page selects. but i do think the menu builder is the best for larger sites; let me know if you need any help on it, i can donate time over the next 2 months.
  18. @kongondo, Thanks for making this. i finally had time to test this out and it's very great - i'm planning to use it from now on for most projects...
  19. you could also escape double quotes, if you're not following the style guide explicitly and wish to have double quotes on the output
  20. page name should be enforced to be unique already, but you could use this for text fields: http://modules.processwire.com/modules/fieldtype-text-unique/
  21. how would one output an optgroup in an options field, if it is somehow possible? ran into this today...
  22. on the last major ec project i worked on we extensively researched magento, but alas it couldn't meet the requirements matrix, whereas wp/woo was able to; However i have 2 ec sites that have been a dream with fc+pw; and have been looking closely at snipcart, and of course padloper...
  23. here's a quick way to change the slider increment for your date timepicker, (this would go in AdminCustomFiles/ProcessPageEdit.js): if(typeof $.timepicker != 'undefined') { $(function(){ $.timepicker.custom = { stepMinute: 15, }; $.timepicker.setDefaults($.timepicker.custom); }); } if you run the latest version of timepicker addon (1.6.1) you can use selects instead of sliders: (for example if you are on current dev/stable, you copy the inputfield to site/modules and tell the system to use that one; then upgrade to the latest timepicker, and copy the new css to the datetime css; if are on devns, word is that it will include the latest version of timepicker). if(typeof $.timepicker != 'undefined') { $(function(){ $.timepicker.custom = { stepMinute: 15, controlType: 'select', oneLine: true, }; $.timepicker.setDefaults($.timepicker.custom); }); }
×
×
  • Create New...