-
Posts
6,671 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
hi and welcome bergy, the topic you are talking about is not an easy one... you can do a forum search (see my signature link) on keywords like "staging", "production", "synch" etc. as always in the world of processwire you have free choice personally i develop locally (i would strongly recommend you take a look on laragon: https://laragon.org/ . i replaced my xampp setup over a year ago and it's really great and fast and you can even put it on a usb drive and have a full dev server with virtual hosts and ssl certificates, mailcatcher etc.). regarding the migrations / staging/dev topic: i develop locally and when i'm (almost) done i put it on the live server. from that time on i develop directly on the server with daily backups and via vscode remote ftp plugin. it has some drawbacks but also some advantages, like monchu already mentioned the quick-fix ability when you are abroad. if you really need a proper dev/live staging system migrations might be the way to go. for simple changes you can also create/edit/remove fields and settings directly in your module so if you push an update to your live system you would also get the same changes to your database. in my projects it was easier to have a simple setup. in the rare case i needed bigger changes i talked to my client that he should not make any changes on day X and i changed their password after copying the live site to something else. of course, this would not work if you had user-input like form submissions or the like. that said, it always depends on the situation. summed up i would say there are three levels of complexity and what i do (or would do) in those cases: simple website with very simple edits --> live edit via SSH / FTP more complex edits with no changes while developing --> backup, do changes locally, upload back to live server complex changes with live changes while developing --> custom migration scripts, migrations module
-
Same here. I think I'll stick to hooks.. Another thing: with AOS turned on I have problems with cke fields. The header is sticky and if you have lots of buttons the textarea will get inaccessible (first screenshot is AOS off and it works):
-
it should always be a pagearray when you get the unformatted value: // change this $items = $page->{$f->name}; // to this $items = $page->getUnformatted($f->name); then you don't need the additional "else" statement
-
Integrating working "required if" conditions in repeater
bernhard replied to Juergen's topic in Wishlist & Roadmap
why don't you use a hook to set the required attribute based on your condition? sounds easier than your way -
How to copy fieldset(Page) values via API to a child page
bernhard replied to Juergen's topic in API & Templates
did you take a look at adrians adminactions module? i think there is a copy repeater contents action and i guess you can adopt it to your needs. -
offtopic, but see also field rendering https://processwire.com/blog/posts/processwire-3.0.7-expands-field-rendering-page-path-history-and-more/#field-rendering-with-template-files wireRenderFile() https://processwire.com/blog/posts/processwire-2.5.2/#new-wirerenderfile-and-wireincludefile-functions and markup regions https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/
-
don't forget to sell yourself (and not the system that you are using) find out what your client is looking for and then tell them what you can offer. if they are looking for a quick & cheap wordpress website (they can have good reasons for that), maybe you are not the right person for the job... (and maybe its also better for you to create one great PW site with a great client than 2 cheap websites with 2 not-so-great clients) think of the following 2 approaches and how the client may feel or what the client may hear: or this one: how would you feel? what would you think? maybe in situation one you would feel bad and confused because there is somebody telling you that something that most of the others are using is a bad choice? in situation two you can see instantly how the client reacts: does he want that quick&dirty way? does he want to be like everybody else? same situation but maybe totally different feelings for your client if he asks you for your reasons you know that he is interested (or at least curious). he knows that you are not the quick&dirty guy and he should not feel offended or over-instructed (telling him if he decides like 80% of all others he will regret - actually, when i read that, that sounds really strange and i totally understand my clients ). thanks for all the other input. i'll try to remember some points for future talks. especially yours @Jonathan Lahijani @DaveP thanks for that example. totally valid points too. especially for us as developers. but think of that in context of my first quote. that may create the total opposite message in your clients head: ah, this guy is a nerd. he speaks a language i don't understand and talks about things most other website owners obviously don't care about...
-
Was also confusing for me! +1
-
you could also use my handsontable module to create an input for each language and then query the column based on the language code and return the price. the module is alpha and you have to be careful when changing settings after field setup as data may bet lost, but maybe it's worth a try.
-
How would you go about using a CDN for images?
bernhard replied to OrganizedFellow's topic in Dev Talk
wow, @abdus thank you for that hint! just took a look at their service and played around with their demo (https://demo.cloudinary.com/?mode=default) and this looks amazing! would love to see a module integrating with their service! -
this query will not be slow, so it would be nice if you showed us your current code
-
-
Have you ever tried to work with reno for some time? my first steps for every project: - reno - tracy - AOS but it took me some time to get used to reno but it's much nicer to work with imho. you have the quicklinks on the left side always available AND you have more space on the right. i guess i didn't like it in the beginning, because it reminded me of the look and feel of wordpress hope we see some action on the new admin theme soon too. and i agree with you guys that the website looks way more old fashioned than processwire is. It's like visiting a website that has the latest news entry saying "merry christmas 2007 to all our visitors!" i always "apologize" for the look&feel when i present processwire to other devs and i tell them that they should take a look under the surface.
-
FieldtypeHandsontable: Excel-like Inputfield
bernhard replied to bernhard's topic in Modules/Plugins
thanks @adrianromega thats the breaking change i was talking about here: -
nothing fancy here. you see it's not polished and some hardcoded values... the javascript to handle the clicks: $(document).on('click', '.ckesnippet', function() { // find correct ckeditor instance $field = $(this).closest('li.Inputfield'); var id = $field.attr('id'); var ckename = id.replace('wrap_',''); var cke = CKEDITOR.instances[ckename]; var data = cke.getData(); cke.setData(data + $(this).data('snippet')); return false; }); and the hook to modify the field: $this->addHookBefore('InputfieldTextarea::render', $this, function($event) { $field = $event->object; if($field->name == 'rockinvoice_suffix') { $del = ''; foreach($this->wire->pages->get(38967)->texttemplates as $item) { $field->entityEncodeText = false; $field->description .= $del . '<a href="#" class="ckesnippet" data-snippet="' . str_replace(PHP_EOL, '', $item->body) . '">' . $item->title . '</a>'; $del = ' | '; } } elseif($field->name == 'rockinvoice_prefix') { $del = ''; foreach($this->wire->pages->get(38967)->texttemplates_greeting as $item) { $field->entityEncodeText = false; $field->description .= $del . '<a href="#" class="ckesnippet" data-snippet="' . str_replace(PHP_EOL, '', $item->body) . '">' . $item->title . '</a>'; $del = ' | '; } } $this->wire->modules->get('RockTools')->loadAsset('ckesnippets.js', 'HrDiamonds'); }); and a repeater to setup the snippets:
-
it's one of many custom "hacks" all the items can be set by the client on a custom settings page. it's a regular repeater. then there is a hook that renders that items as field description and some javascript that adds the html to the ckeditor. thanks. no problem at all. but there's not really a lot of data... the table showing all the revenues for different years is a custom DB-view because there's no built in possibility for such listings in pw. the pw alternative would be many many foreach loops and thats a no-go.
-
Preview/Discussion: RockDataTables
bernhard replied to bernhard's topic in Module/Plugin Development
hi adrian, data is stored just as normal pw pages. nothing fancy here. this makes it very easy to use! the current setup is that you need 3 files to define your field: // yourfield_data.php <?php // return all relations that belong to this project return $pages->find( "template=feedback". // find all relations ",has_parent=$page" // project must be the current project ); // yourfield_columns.php <?php namespace ProcessWire; // sample column showing the ID of the page $col = new dtCol(); $col->name = "id"; $col->title = 'Columns ID'; $col->data = function($page) { return $page->id; }; $this->cols->add($col); // yourfield_js.js (optional, but in most cases necessary to do advanced stuff) var settings = { select: true, pageLength: 100, }; I'm also very excited to take this further. I cannot release it at the current stage though because major changes are not only likely to come but almost planned i have to work more on performance. I'm thinking about some kind of caching technique and maybe also providing AJAX pagination. some things like column statistics would only work on the client side when all the data is loaded, though. but i know that datatables can handle several thousands of rows quite efficiently so i think i'll find a way to work with those amounts of data. -
i totally agree. i don't think it's necessary, but i think it would be nice to have a warning on the login site. a simple noscript tag could make things clear and save us from support-requests like "hey, my admin tree does not show up" where one's first thought could be a permission problem or the like...
-
pw needs javascript all over in the admin so there's no way to make it work without. i agree it would be nice to add a warning. the login screen would be a nice place. you could do a PR and add some warning here that would be hidden via javascript and therefore only visible to clients without javascript. https://github.com/processwire/processwire/blob/master/wire/modules/Process/ProcessLogin/ProcessLogin.module#L427-L451
-
Preview/Discussion: RockDataTables
bernhard replied to bernhard's topic in Module/Plugin Development
another example how versatile and extendable this module is: you can write your own plugins to show custom column statistics. here i'm showing max, average and minimum values of some collected feedbacks. X means no answer and is excluded from the stats: plugincode is quite simple once you know the basics of datatables api: $(document).on('update.rdt', 'div.colstats, div.colstatsselected', function(e, table, col) { var $div = $(e.target); var $table = $(table); var table = $table.DataTable(); // get table settings var id = $table.attr('id').replace('RockDatatable_',''); var dt = ProcessWire.config.RockDatatables[id]; var colname = dt.columnNames[col.index()]; var selector = {search: 'applied'}; if($div.hasClass('colstatsselected')) selector.selected = true; // get data var data = table .rows(selector) .data() .filter(function(row) { // return true if it is a number // don't count empty cells or "noanswer" cells that have an X return row[colname]*1; }) .pluck(colname); // get sum + rows var sum = data.sum(); var rows = data.length; // early exit? if(!sum || !rows) { $div.html(''); return; } // add stats for each column var avg = sum / rows; $div.html( ' ↑ ' + Math.max.apply(null, data) + ' ø ' + avg.toFixed(2) + ' ↓ ' + Math.min.apply(null, data) ); }); -
yeah, he is the developer of the images fieldtype... so the question is why he thinks it would be bad to handle allowed extensions and maxfile settings in a template context?!
-
very interesting article and very well put together. i'm wondering why for example the maxfiles setting for images fields is not activated by default for template context. any ideas on this?
-
very nice site! maybe profiler pro can help you finding bottlenecks? https://processwire.com/api/modules/profiler-pro https://processwire.com/api/modules/profiler-pro/#pages i have not worked with it but would be interested to see an example
-
thank you all for your kind words! would be nice to see some screenshots or to hear what you did
-
thanks @AndZyk i removed one of my large screencasts and have now another 10MB left. but still i find that restriction VERY annoying and is imho not good for active forum members that contribute a lot. @Pete is there maybe an option to set a special limit per time period?