Jump to content

bernhard

Members
  • Posts

    5,722
  • Joined

  • Last visited

  • Days Won

    271

Everything posted by bernhard

  1. I'd vote for that. I've tried a multisite setup years ago but then ended up in a mess where I had several websites using one multisite setup and one breaking all others or being extremely tedious to bring out of that setup. Customizations are not so easy, you might have modules that do not work on a multisite setup etc etc. But maybe it was only me and it's working well for others. I'm happy to hear different experiences!
  2. Just for reference, I think the easiest way to do aggregations at the moment is creating a regular finder and taking the resulting SQL as subquery and modifying it to your needs: And if you need it in your code (not in the RockFinder Tester) you need to set the SQL via $finder->sql:
  3. You are right, so I guess the docs are misleading in this case.
  4. Am I using it wrong or is this a bug? According to the docs it should support the array syntax, shouldn't it?
  5. Thx again! I knew there was such a possibility but was looking all over the wrong spots ? echo $uk->home->rocktheme_footermenu->implode(" | ", function($p) { return "<a href='{$p->url}'>{$p->title}</a>"; }); Now it feels like PW again ?
  6. Here are the docs: https://processwire.com/api/ref/wirearray/each/ I simply want to create a footer-menu... nothing fancy, but I thought instead of foreach I'd use the each() method... but some details are missing for this use: The method can return a concatenated string or an array of items. What I'd need - or at least what I think what I'd need - is that it returns an array of generated strings. The Problem: $pages->each("<a href='{$url}'>{$title}</a> | "); Results in Item 1 | Item 2 | If it returned an array with those strings I could simply do this: echo implode(" | ", $items); Using this syntax does also not work: $pages->each(["<a href='{url}'>{title}</a>"])); As it returns this crazy array where I can't use implode() either: My traditional way of doing this would be this: $del = ""; foreach($uk->home->rocktheme_footermenu as $p) { echo "$del<a href='{$p->url}'>{$p->title}</a>"; $del = " | "; }; But I think this would be nicer and feel more like PW: echo implode(" | ", $uk->home->rocktheme_footermenu->each("<a href='{url}'>{title}</a>")); Am I missing anything or would it be nice to have the Option of returning a simple array of strings?
  7. Thx for the hint! This calls for being built into a pw module ?
  8. Hey! I'm developing a module for easy and fast frontend development (something like theming) and implemented favicons yesterday. Referencing one favicon for browsers is one thing, but referencing all different versions another... I used http://www.favicomatic.com/ that generates all the favicons for me and it also creates a code.txt file with the necessary markup. Now in my module I just have to upload a favicon to their website and place all the files in a specific folder of my module. Everything else is done automatically. That's quite nice, but I was wondering how you guys are doing it? Is my linked service a good choice? There is also https://realfavicongenerator.net/ but this has the drawback for me that it does not generate a codefile so I'd have one extra step in the process. Thx for your opinions!
  9. Hi @MarkE and welcome to PW and the forum ? I think PW is great for building what you described. But I'm "a little" biased as I build everything with PW from simple websites to complex custom CRM and Feedback Tools... Yes. Is it a sports club? Then you can have a look at mistelbach-mustangs.at's calendar or the team site. Sounds good to me. But I'd recommend starting in the backend first (more on that later). You'll get an idea of how everything works and you might be better off doing the frist part also in the backend. That's not a general statement, you'll just be able to do a better decision once you know how the system works and it might save you from building a custom frontend once you know how easy it is to build custom backends ? Not sure about this one. I guess your wording is just a bit different from the PW world. I guess you mean you want to want to modify your data objects, right? So in PW this would mean your objects are pages, and your properties are fields. Classes would be templates, so for example you could have a template (~class) "team", an instance of this class would be the object, in PW this would be a page "Team A", and to modify it you'd simply add/remove/edit such a page. And yes, you can control anything you want here easily. You can set permissions in the backend and you can even set permissions on a field level. If that still is not enough there are several helper modules out there: https://modules.processwire.com/categories/users-access/ And if that still is not enough control, it's really easy to attach hooks or for reusability and better code organization it's also dead simple to create custom modules. That does sound strange again. The PW backend is just an application built on top of the PW API to manage it's own data (crazy and genius). Just have a look at the page tree and find your admin's root page (page id = 2). Most of the pages there use the "admin" template, but not all, for example the permissions have their own "permission" template: Having an "admin" template just makes it possible to assign a ProcessModule to this page. That means visiting this page via its URL calls the selected process module: So, creating your own admin pages is really nothing else than creating a PW page with template "admin", creating a ProcessModule for it and assigning it to that page. Have fun ?
  10. Tried that now but still have red <region> tags. Which version of VSCode are you running? I think there was an update that changed the tag grammar some time ago...
  11. That sounds great @BitPoet, thx! Could you please elaborate a little more on that? Thx ?
  12. Thx, unfortunately this did not really help. It seems that this has something to do with the color theme. Some themes do invalid items red, others don't. Unfortunately I was not able to create a custom version of the default dark plus theme that only overrides the invalid token color setting. It seems to be not as easy as setting the option in the user settings. And copying the theme and overriding did not work for me. Has anybody of you tried this before with success?
  13. Does anybody of you know how one can make VSCode not display pw markup regions in alerting red?
  14. You are obviously missing TracyDebugger ?? SCNR, but joke aside, tracy does also help you a lot on ajax debugging. It has fl() = firelog and bd() = bardump that can help a lot to see what's going on! A quick guess: If you are using custom AJAX scripts it might be the case that the headers are not set correctly so that PW recognizes it as $config->ajax == true. Maybe that's not at all helpful, not sure, but in a hurry ?
  15. Thanks robin, using the config.js file it worked as expected. It still does not work using the inputfield settings... I used the exact same string that you have in your screenshot... No idea. But it's fine for me now that the workaround is in place.
  16. v18 adds a plugin that can sync page fields with rockgrid columns: Example Setup Adding the asm in a processmodule. $fs is a fieldset where we add our InputField to. $gridname is the name of the grid that is connected. // which lists to show $this->wire->config->scripts->append($this->wire->urls($this) . "scripts/manageLists.js"); $fs->add([ 'type' => 'InputfieldAsmSelect', 'name' => 'listsToShow', 'label' => __('Show list membership for...'), 'attr' => ['data-grid' => $gridname], 'asmOptions' => ['sortable'=>false], ]); $f = $fs->getChildByName('listsToShow'); $f->setAsmSelectOption('sortable', false); foreach($pages->get('template=rockmailer_lists')->children as $item) { $f->addOption($item->id, $item->title); } And the portion of the javascript file: // sync ASM field with displayed lists in grid // attach event listener when document is ready $(document).ready(function() { var $select = $('#Inputfield_listsToShow'); var colPrefix = 'rockmailer_list_'; RockGrid.plugins.syncAsmSelect({ asm: $('#Inputfield_listsToShow'), grid: RockGrid.getGrid($select.data('grid')), colName: function(pageId) { return colPrefix + pageId; }, colDef: function(col) { col = RockGrid.colDefs.yesNo(col, { isYes: function(params) { var pageId = String(params.column.colId).replace(colPrefix, ''); var lists = String(params.data.rockmailer_lists).split(','); return lists.indexOf(pageId) > -1 ? true : false; } }); col.pinned = 'left'; return col; } }); }); In this case we set a custom callback to modify the colDef for the column. It uses the yesNo plugin to show icons instead of true/false values:
  17. I've just added this plugin successfully: https://ckeditor.com/docs/ckeditor4/latest/guide/dev_colorbutton.html Unfortunately it seems that the field's settings do not have any effect ? I tried several versions: {"colorButton_colors": "FFB400", "colorButton_enableAutomatic": false} {"config.colorButton_colors": "FFB400", "config.colorButton_enableAutomatic": false} colorButton_colors: "FFB400" config.colorButton_colors: "FFB400" It still shows all the default options: Can anybody help me, please?
  18. Just found nolt.io by coincidence and tried it out... It's really simple to setup a Roadmap with voting functionality: https://53261ae5.nolt.io/ What do you think? Could that be useful?
  19. I'd recommend using Tracy Debugger for two reasons You have the field settings and field code panels where you can inspect your necessary properties Tracy has many many examples of how you can add fields to your module's config screen $f = $this->wire('modules')->get("InputfieldAsmSelect"); $f->attr('name', 'hideDebugBarFrontendTemplates'); $f->label = __('No debug bar in selected frontend templates', __FILE__); $f->description = __('Disable the debug bar on pages with the selected templates.', __FILE__); $f->columnWidth = 50; foreach($this->wire('templates') as $t) { $f->addOption($t->id, $t->name); } if($data['hideDebugBarFrontendTemplates']) $f->attr('value', $data['hideDebugBarFrontendTemplates']); $fieldset->add($f);
  20. Are you talking about the backend or frontend? ProcessWire has https://github.hubspot.com/vex/docs/welcome/ on board.
  21. Awesome to see that, need to look at that library as I've never heard about it... I've built a function to get data instantly very easily - have a look at the pluck() function in RockGridItem.js; It works similar to jQuery Datatables library that I've used before. And I found getting data there quite easier than with aggrid. That's why I built a similar replacement. See this example where I can select selected or filtered items: // get items var rockmailer_to = $('input[name=rockmailer_to]:checked').val(); var items; var testmail = false; if(rockmailer_to == 'selected') items = grid.pluck('id', {selected: true}); else if(rockmailer_to == 'filtered') items = grid.pluck('id', {filter: true}); else { // custom test address var testmail = $('#Inputfield_rockmailer_test').val(); if(!testmail) { ProcessWire.alert('You need to specify a Test-Mail-Address!'); return; } items = [testmail]; testmail = true; } if(!items.length) ProcessWire.alert('No items selected/filtered'); Wow @Beluga just had a look at apex charts and that looks fantastic! I was short before creating a module for chartjs but then quite a lot of client work popped in... I'd be very happy to assist you in creating a charting module that plays well together with RockGrid, so if you are interested please drop me a line via PM ?
  22. The new concept of function for manipulating the columns really makes sense and is great to work with ? Whenever you create useful coldef functions please let me know - maybe others can also benefit from it. Here is one new that I just added: RockGrid.colDefs.yesNo() Here a simple example showing the status of an E-Mail (sent yes or no): col = grid.getColDef('rockmailer_sent'); col = RockGrid.colDefs.yesNo(col, {headerName: 'Status'}); And here a "more complex" example that splits a page reference field with a list of IDs and returns true if a page is part of that list and false if is not: col = RockGrid.colDefs.yesNo(col, { headerName: grid.js.listtitle, isYes: function(val) { if(!val) return false; val = val.split(","); return val.indexOf(String(grid.js.list)) > -1 ? true : false; } });
  23. Glad you got it working, seems you start having fun using it? ? What chart library are you using?
×
×
  • Create New...