Jump to content

bernhard

Members
  • Posts

    5,974
  • Joined

  • Last visited

  • Days Won

    289

Everything posted by bernhard

  1. as far as i understood this would only be possible for superusers and i would definitely not give your client superuser access... i think you have those options: profield table backend gui, but very clean and easy to manage, 150 items is a lot though repeater backend gui, little more "bloated", not sure how this would work for 150 items... pagetable you could use FE, but you need to implement add/delete/move functionality on your own. add/delete would be very simple, move would be a little more complicated. you could also do the sorting based on the position number (item number, seems to be your first field). that would maybe be not so user friendly. how do you plan to do the item numbering? automatically? why do you plan to have a field for that?
  2. you could use the core pagetable field, then you would also have frontend editing. adding and removing items would need some manual work but would not be very hard (send an ajax request, create a page with dummy-data, reload the frontend, double click to edit text)
  3. @Lenz what is so bad about the admin UI? see this post for example using the adminbar module there is also FREDI and FEEL. not as good as real frontend-editing, i admit, but close
  4. you should definitely invest some minutes and start writing process modules. it's incredible how fast you can create your very own admin GUIs and you will learn to understand processwire a lot better define "success" i agree with most of all posts above but i also want to say that i like the fact (or at least it seems to be like this) that we do NOT attract a lot of "i am looking for a click click and it's done" users. i like the way people here behave, trying to learn things, trying to understand, trying to find their way around the code... maybe if processwire looked more fancy that would be different. i don't know. and maybe it's not ryans goal to become more popular. the roadmap states it as a goal for 2017 - but i'm not sure how important it is for ryan. personally i would love to hear more personal and strategic infos regarding the project. who is the team behind processwire? is it only ryan? what happens if ryan can not continue to work on it? he said at several occasions that there ARE people that could continue the project but i would love to have a more reliable solution/statement for that. i don't really care if we have 10.000 or 10.000.000 users - but i do care if i have enough certainty to be able to work with some kind of software on the long run. to be honest i have some concerns about the last point sometimes. but i calm myself knowing that even if processwire would not get updated for a long time it would still run safely and without any issues and i would have enough time to learn something else
  5. just pushed another update! CAUTION: THIS HAS A BREAKING CHANGE since I changed how the settings get modified. the reason why i did this is that some settings can only be set BEFORE initialisation of the table. the customBorders is an example. you now have two events that you can hook into: beforeInit.rht afterInit.rht If you want to modify the settings before initialisation you can do this: // make custom borders $(document).on('beforeInit.rht', '.handsontable', function(e, settings) { $.extend(settings, { customBorders: [{ range: { from: { row: 0, col: 2 }, to: { row: 10, col: 2 } }, left: { width: 4, color: 'red' }}], }); }); after initialisation you can do this (similar to how it was before): $(document).on('afterInit.rht', '.handsontable', function(e, hot) { var colheaders = ['one', 'two', 'three']; hot.updateSettings({ colHeaders: colheaders, minCols: colheaders.length, maxCols: colheaders.length, }); }); now you can also add CSS files to your table by naming it like your field and saving it inside the /fields folder: #wrap_Inputfield_archimport .handsontable td:nth-child(2), #wrap_Inputfield_archimport .handsontable th:nth-child(2) { border-right: 4px solid #6c6c6c; } #importbutton { margin-top: 10px; }
  6. try outputting the image url as plaintext <p><?= $yourimage->url ?></p> also check the return setting of your images field. it can be set as array or single image. if it is set as array you would have to define wich image to show (eg $yourimages->first()->url )
  7. version 3 adds support of file-based code snippets. just put a file with the field's name inside the /fields folder
  8. hi roland and welcome to the forum, i read your other posts and i also see two options: 1) if you WANT to learn and are not afraid of writing some code you'll always find someone here that is willing to help 2) if you want a quick solution and stay in your (i quote you here and mean it bad in no way) "wordpress click click and boom ready" - world I'm sure you find a developer in the job-board that can help you
  9. seems to work, thanks not cached: cached:
  10. would be nice to have in tracy we got closer! deleted the cache and the error appeared again. last file seems to be /site/modules/RockMpdf/mpdf6/vendor/mpdf/mpdf/mpdf.php - this file has 1,1MB
  11. sorry no memory issue any more is there some caching that i can reset? i had to decrease it to 16MB to get the error... thanks, works!
  12. for me it is only one click on the heart (also have to get used to that ^^)
  13. hi @Martin Muzatko i would recommend you read the docs about hooks carefully: https://processwire.com/api/hooks (especially here: https://processwire.com/api/hooks/#add_new_method ) to your problem: try this: public function getMessagesBySender($event) { $user = $event->object; $sender = $event->arguments[0]; $event->return = $user->getMessages()->find('sender='.$sender); } you could also modify your getMessages method to take an argument as selector and then use it like this: $user->getMessages("sender=$user"); // additional tip: double quotes makes it easier to read sometimes ;) regarding the "event system": $event in the hooks is the hookevent object. you could call it whatever you want, but as it's called $event everywhere in PW it's good to stay with this naming. the object is needed by PW and it's hook system so you cannot just "return" from inside the method. or to be more clear: you can just return but then it will not change anything. thats the way how you can do early exits: $wire->addHookAfter('Pages::added', function($myHookEvent) { $page = $myHookEvent->arguments(0); if($page->template != 'mytemplate') return; // example of early exit [...] } here i named $event differently just as a showcase. the $event->return property holds the "value" of the hooked method. this can be different things, for example a PageArray if you hook a page find operation or a simple string if you hook a field's value. This value is only one thing that is needed by processwire to fully execute the request. For example there is also the $event->replace property that would tell PW to completely replace the hooked method if it was set to TRUE - so pw would not call the original method after the hook was executed (this only works on before-hooks, of course). https://processwire.com/api/hooks/#replace_method hope this makes sense for you. i would also recommend using tracy debugger - it's a lot more powerful and easier to read than var_dump
  14. nice and besides that it is easy to add i think it would be nice to have it in the core. maybe you can add a PR @Martin Muzatko ?
  15. hi @Pete sorry for being a little off-topic but you didn't read my PM from july... is there a reason why ma attachment limit seems to be always decreasing? i have only 2MB limit left and it seems it's getting lower and lower... thx
  16. what about this? <?php $allTitles = $yourPageArray->each('title'); // or if it was more complex $allTitles = $yourPageArray->each(function($page) { return "{$page->forename} {$page->surname}"; } you can also add your own methods via hooks: $wire->addHookMethod('WireArray::test', function($event) { $arr = $event->object; $out = []; foreach($arr as $item) $out[] = 'testing page ' . $item->id; $event->return = $out; });
  17. @abdus i like the idea of using only one field and adding options via hooks, but i don't think it's the most userfriendly to throw an exception after pagesave in case someone uploads more than 1 image. i guess it should be possible to set the max-file setting and show the upload on the client side before upload?
  18. sorry my solution only works if you have zip-codes like 1... 2... 3... 10... and 19... would be listed under 1... you could replace the for(...) with this $zipcodes = [11, 15, 80, 99]; foreach($zipcodes as $zip) { ... } always depends what your initial data looks like (if you know the zip-code-categories or if they are dynamic). 1 question, so many answers
  19. hi and welcome deceleration quite easy: <?php // overview for($i=1; $i<??; $i++) { echo "<a href='./$i'>"; // create a link with that url segment echo "ZIP $i... [" . $pages->count("template=yourtemplate, zipcode^=$i") . "]"; echo "</a><br>"; } // details $zip = $sanitizer->int($input->urlSegment1); if($zip) { $items = $pages->find("template=yourtemplate, zipcode^=$zip"); foreach($items as $item) { echo "<a href='{$item->url}'>{$item->title}</a><br>"; } }
  20. Never said that I would recommend reading my second link carefully and trying out markup regions (... And building your site with a template for your child pages instead of URL segments)
  21. datatable connected to the pagefield updating the pageautocomplete field seemed a little tricky in the beginning but the final approach was quite easy: // handle buttonclicks $('#addcompetences').click(function(e) { e.preventDefault(); var table = $table.DataTable(); // datatable instance var $field = $('#wrap_Inputfield_competences'); // asm select field var $template = $field.find('li.itemTemplate'); // selected page template var $ol = $template.closest('ol'); // get selected competences from table var selectedtable = $.map( table.rows({selected:true}).data(), function(val, i) { return [[ val.id.sort, val.title + ' (' + val.cluster.filter + ')' ]]; } ); // update ASM // clone template and populate values $.each(selectedtable, function(i,val) { // check double if($ol.find('.itemValue:contains("' + val[0] + '")').length) return; // add clone var $new = $template.clone().appendTo($template.parent()); $new.find('.itemValue').text(val[0]); $new.find('.itemLabel').text(val[1]); $new.removeClass('itemTemplate'); }); // add state changed class $field.addClass('InputfieldStateChanged'); // update original input InputfieldPageAutocomplete.rebuildInput($ol); return false; });
  22. abdus code would work great, but still i don't understand what is bad about having a template file for each of your children. url segments in those cases have some drawbacks that you may not think of before and always need some extra work (for example creating a sitemap, multilanguage or the like...). hearing that this scenario makes problems for you i guess maybe your setup is not optimal. using https://processwire.com/docs/tutorials/how-to-structure-your-template-files/page4 this would be very easy. and using https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/ it would be even easier.
×
×
  • Create New...