Jump to content

Macrura

PW-Moderators
  • Posts

    2,780
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Macrura

  1. this module definitely wasn't loading the .css file, but i have no idea why - could it be the name of the module? For now i'm able to get it to load using the code above, but would be curious as to why...
  2. In terms of building this module (PageDocsTab), i wonder how to deal with it needing to work with a 3rd party fieldtype, namely FieldtypeTemplates, because the way i have it working is that you specify on the doc which templates to show that particular doc on, so that field needs to be added to the template that is being used for "Docs'. I guess it could be in the instructions and also could be made a requirement that the fieldtype is installed before installing this one... and then once this module is installed it could create the required field, e.g. 'template_select'... Another question - i've looked through a bunch of modules and i was under the impression that if you had css or js named the same as the module that it would load them, and in some modules i don't see any code to load css or js, even though there are css and js files in the module folder; on the URL checker module, this code is used to get the css to load: $this->config->styles->add($this->config->urls->siteModules . __CLASS__ . '/' . __CLASS__ . '.css?v=' . time()); so is this the recommended/correct way?
  3. whoa - sweet - super amplified thanks for this... just tested and totally works... !
  4. ok thanks - i will research again tonight and try and venture forth; in the meantime I might change it to an integer input ("please enter the page ID of the root for docs..")
  5. right, i will check the database shortly... i've spent some hours looking at other modules including the menu builder, to try and figure out how to get a page list select to work for module setting...
  6. many thanks - but i can't seem to get the module to save the selected page; it shows the field but it reverts to unselection after you hit submit..
  7. Hi - i have a module i'm trying to improve so i added a page list select to the getModuleConfigInputfields function like this: $fieldDocsRoot = wire('modules')->get('InputfieldPageListSelect'); $fieldDocsRoot->attr('name+id', 'docsRoot'); $fieldDocsRoot->label = __('Docs Root', __FILE__); $fieldDocsRoot->description = __('Select the root page of your docs. (Allows the module to know where to create new docs.', __FILE__); $fieldDocsRoot->attr('title', __('Docs root', __FILE__)); $wrapper->add($fieldDocsRoot); i also tried to init the docRoot var up in __construct, but i can't figure out how to get it to save the page on that inputfield.. TIA
  8. @Jon - the wire class can be used inside functions - so in the case of Joss' issue, he wanted the solution to be in a function. when outside of a function like in a template you can use the $pages variable directly...
  9. sorry, yeah that was a profields; removed it now...not super relevant anyway
  10. yes, there is an extensive discussion of that here, with code of how to achieve that: https://processwire.com/talk/topic/4991-sub-arrays-dates-times-and-pure-hell/ other options: https://processwire.com/talk/topic/6733-better-way-to-finding-all-years/#entry65975 https://processwire.com/talk/topic/11690-display-results-with-a-year-heading-using-datetime-field/?p=108709
  11. maybe you need this instead of the foreach $out .= "<img src='{$item->images->first()->url}' />";
  12. 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.
  13. 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
  14. 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; }
  15. 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;
  16. 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.
  17. 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
  18. 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
  19. yeah, like this insanity: https://developer.joomla.org/security-centre/630-20151214-core-remote-code-execution-vulnerability.html
  20. 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.
  21. it might work, but you could also try page table - might be a little cleaner UI
  22. awesome, many thanks for this! will be upgrading mods tomorrow...
  23. 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?
  24. 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?
  25. @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)
×
×
  • Create New...