Jump to content

joe_g

Members
  • Posts

    395
  • Joined

  • Last visited

Everything posted by joe_g

  1. two good suggestions - thanks! Media manager looks particularly impressive
  2. In a lot of projects I find myself making the difficult decision between the ability to drag-upload 20 jpg images and the ability to add other file-types in between. It's a choice between easy upload or versatility in the structure. It's been an ongoing quest for me, for a couple of years so I'm checking back to see if there are any new solutions to this since, say, the last 3 years? The dream would be to allow drag drop a bunch of files into a repeater field and automatically create children depending on the file type (mp4, jpg, etc). But maybe there are other ways?
  3. @horst ...Wow!! I had no idea and I've been using PW since about forever. thank you!
  4. @horst For a second I thought there was a built in zip unpack in PW, but it doesn't seem like it. Uploading a zip gives 'invalid image'. The client (or me) drags 20 images to an images field, but about 10 makes it after save. Are you sure there is a way to do this via zip?
  5. Thanks! Your link is about disabling fingerprinting. I remember that being an issue in the past, but didn't help this time Because it happens with some regularity, but with different images, it almost feels like it's some form of throttling on the servers. Maybe a security measure not to allow too many authenticated connections at once? Sounds weird, and I've never seen anything similar before. It's the same across browsers and computers, so not a client side issue probably. The host is TSO (UK).
  6. Here is a new thread about image upload problems. I think it's a new one, I've been through all the old threads I could find. When uploading multiple images at once (dragging) SOME fails. It's about 50%. Tried debug=true and false (remember this solving the problem in the past) It's not always the same images that fails Successful uplads gets JSON back Failed uploads get HTML back Nothing interesting from errors.log or the other logs No logs from Tracy ONCE I've gotten a SQL error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3947-0' for key 'PRIMARY' (in /wire/core/FieldtypeMulti.php line 305) ProcessWire 3.0.148 © 2020 PHP 7.3 Success JSON: [{"error":false,"message":"Added file: run3_3382889b-2.jpg","file":"\/beta\/site\/assets\/files\/3942\/run3_3382889b-2.jpg","size":86775,"markup":"<li id='file_c55bcbd2fa4f1a2517b1a2ba0c025920' class='ImageOuter gridImage ui-widget'><div class='gridImage__tooltip'><table><tr><th>Dimensions<\/th><td>620x399<\/td><\/tr><tr><th>Filesize<\/th><td>85 kB<\/td><\/tr><tr><th>Variations<\/th><td>0<\/td><\/tr><\/table><\/div>\n\t\t\t<div class='gridImage__overflow'>\n\t\t\t\t<img src=\"\/beta\/site\/assets\/files\/3942\/run3_3382889b-2.0x260.jpg?nc=1598018196\" alt=\"\" data-w=\"620\" data-h=\"399\" data-original=\"\/beta\/site\/assets\/files\/3942\/run3_3382889b-2.jpg?nc=10\" data-focus=\"50 50 0\" \/>\n\t\t\t<\/div>\n\t\t\t\n\t\t\t\t<div class='gridImage__hover'>\n\t\t\t\t\t<div class='gridImage__inner'>\n\t\t\t\t\t\t<label for='' class='gridImage__trash'>\n\t\t\t\t\t\t\t<input class='gridImage__deletebox' type='checkbox' name='delete_images_c55bcbd2fa4f1a2517b1a2ba0c025920' value='1' title='Delete' \/>\n\t\t\t\t\t\t\t<span class='fa fa-trash-o'><\/span>\n\t\t\t\t\t\t<\/label>\n\t\t\t\t\t\t<a class='gridImage__edit'>\n\t\t\t\t\t\t\t<span>Edit<\/span>\n\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\t\t\t\t<div class='ImageData'>\n\t\t\t\t\t<h2 class='InputfieldImageEdit__name'><span contenteditable='true'>run3_3382889b-2<\/span>.jpg<\/h2>\n\t\t\t\t\t<span class='InputfieldImageEdit__info'>85 kB, 620×399 <\/span>\n\t\t\t\t\t<div class='InputfieldImageEdit__errors'><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__buttons'><small><button type='button' data-href='\/beta\/processwire\/page\/image\/edit\/?id=3942&file=3942,run3_3382889b-2.jpg&rte=0&field=images' class='InputfieldImageButtonCrop uk-button uk-button-small uk-button-text uk-margin-small-right pw-modal-large pw-modal' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'><i class='fa fa-crop'><\/i> Crop<\/button><button type='button' class='InputfieldImageButtonFocus uk-button uk-button-small uk-button-text uk-margin-small-right'><i class='fa fa-circle-o' data-toggle='fa-circle-o fa-dot-circle-o'><\/i> Focus<\/button><button type='button' data-href='\/beta\/processwire\/page\/image\/variations\/?id=3942&file=run3_3382889b-2.jpg&modal=1&varcnt=varcnt_images_c55bcbd2fa4f1a2517b1a2ba0c025920' class='uk-button uk-button-small uk-button-text uk-margin-small-right pw-modal-large pw-modal' data-buttons='button'><i class='fa fa-files-o'><\/i> Variations <span class='ui-priority-secondary'>(1)<\/span><\/button><\/small> <select class='uk-select uk-form-small InputfieldFileActionSelect' name='act_images_c55bcbd2fa4f1a2517b1a2ba0c025920'><option value=''>Actions<\/option><option value='dup'>Duplicate<\/option><option value='fv'>Flip vert<\/option><option value='fh'>Flip horiz<\/option><option value='fb'>Flip both<\/option><option value='r90'>Rotate 90°<\/option><option value='r180'>Rotate 180°<\/option><option value='r270'>Rotate 270°<\/option><option value='r-90'>Rotate -90°<\/option><option value='r-180'>Rotate -180°<\/option><option value='r-270'>Rotate -270°<\/option><option value='bw'>B&W<\/option><option value='sep'>Sepia<\/option><\/select> <span class='InputfieldFileActionNote detail'>Action applied at save.<\/span><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__core'><div class='InputfieldFileDescription'><label for='description_images_c55bcbd2fa4f1a2517b1a2ba0c025920' class='detail pw-hidden'>Description<\/label><input type='text' name='description_images_c55bcbd2fa4f1a2517b1a2ba0c025920' id='description_images_c55bcbd2fa4f1a2517b1a2ba0c025920' placeholder='Description…' value='' \/><\/div><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__additional'><\/div>\n\t\t\t\t\t<input class='InputfieldFileSort' type='text' name='sort_images_c55bcbd2fa4f1a2517b1a2ba0c025920' value='1' \/>\n\t\t\t\t\t<input class='InputfieldFileReplace' type='hidden' name='replace_images_c55bcbd2fa4f1a2517b1a2ba0c025920' \/>\n\t\t\t\t\t<input class='InputfieldFileRename' type='hidden' name='rename_images_c55bcbd2fa4f1a2517b1a2ba0c025920' \/>\n\t\t\t\t\t<input class='InputfieldImageFocus' type='hidden' name='focus_images_c55bcbd2fa4f1a2517b1a2ba0c025920' value='50 50 0' \/>\n\t\t\t\t<\/div>\n\t\t\t<\/li>","replace":false,"overwrite":0}] HTML returned when failed <form id="ProcessLoginForm" class="InputfieldFormFocusFirst InputfieldFormNoWidths InputfieldFormVertical uk-form-vertical InputfieldForm" method="post" action="./?id=3942" data-colspacing="0"><script>if(!navigator.cookieEnabled) document.write('<p class=ui-state-error-text>Cookie check failed: please enable cookies to login.</p>');</script><noscript><p class=ui-state-error-text>Javascript check failed: please enable Javascript to login.</p></noscript><ul class='Inputfields uk-grid-collapse uk-grid-match' uk-grid uk-height-match='target: > .Inputfield:not(.InputfieldStateCollapsed) > .InputfieldContent'><li class='Inputfield InputfieldText Inputfield_login_name collapsed9 uk-width-1-1' id='wrap_login_name'><label class='InputfieldHeader uk-form-label' for='login_name'>Username</label><div class='InputfieldContent uk-form-controls'><input id="login_name" class="ProcessLoginName uk-input InputfieldMaxWidth" name="login_name" type="text" maxlength="2048" /></div></li><li class='Inputfield InputfieldText Inputfield_login_pass collapsed9 uk-width-1-1' id='wrap_login_pass'><label class='InputfieldHeader uk-form-label' for='login_pass'>Password</label><div class='InputfieldContent uk-form-controls'><input id="login_pass" class="ProcessLoginPass uk-input InputfieldMaxWidth" name="login_pass" type="password" maxlength="2048" /></div></li><li class='Inputfield InputfieldSubmit Inputfield_login_submit uk-width-auto uk-margin-top' id='wrap_Inputfield_login_submit'><div class='InputfieldContent uk-form-controls'><button id="Inputfield_login_submit" class="ui-button ui-widget ui-state-default ui-corner-all" name="login_submit" value="Login" type="submit"><span class='ui-button-text'>Login</span></button></div></li><li class='Inputfield InputfieldHidden Inputfield_login_hidpi uk-width-1-1' id='wrap_login_hidpi'><label class='InputfieldHeader uk-form-label' for='login_hidpi'>login_hidpi<i title='Toggle open/close' class='toggle-icon fa fa-fw fa-angle-down' data-to='fa-angle-down fa-angle-right'></i></label><div class='InputfieldContent uk-form-controls'><input id="login_hidpi" name="login_hidpi" value="0" type="hidden" /></div></li><li class='Inputfield InputfieldHidden Inputfield_login_touch uk-width-1-1' id='wrap_login_touch'><label class='InputfieldHeader uk-form-label' for='login_touch'>login_touch<i title='Toggle open/close' class='toggle-icon fa fa-fw fa-angle-down' data-to='fa-angle-down fa-angle-right'></i></label><div class='InputfieldContent uk-form-controls'><input id="login_touch" name="login_touch" value="0" type="hidden" /></div></li><li class='Inputfield InputfieldHidden Inputfield_login_width uk-width-1-1' id='wrap_login_width'><label class='InputfieldHeader uk-form-label' for='login_width'>login_width<i title='Toggle open/close' class='toggle-icon fa fa-fw fa-angle-down' data-to='fa-angle-down fa-angle-right'></i></label><div class='InputfieldContent uk-form-controls'><input id="login_width" name="login_width" value="0" type="hidden" /></div></li></ul><input type='hidden' name='TOKEN1019986142X1598018203' value='6pe86O2MtD6nttH6QOfKyYQYFyuo45rP' class='_post_token' /></form><p><div><a href='/beta/'><i class='fa fa-home'></i> Home</a></div></p> many thanks!
  7. perfect, thanks ->matrix('label') worked for me!
  8. How can i get the label of the repeater matrix entry? I can easily get then type with ->type, but I can't get the label with ->label thanks!
  9. I managed to get this to work by instead upgrading the site on the live server. I still got the 'start is reserved word' error, but the trick from @adrian worked in this case. I just renamed the table field_start -> field_start2, then in the fields table as well. I change the code accordingly. Worked really well. To answer @kongondo: No its' not multilingual, nor multisite. Also not running mod_security. Not sure why this update wouldn't work on my dev server. Both servers are running php 7.3. I suspect I had some other issue with permissions and template caching on my server, possibly unrelated to the above.
  10. Thanks for your help. The version is ProcessWire 3.0.36 © 2020, so perhaps not mega old. Looks like I have other problems than just the field name. It's more some server compatibility thing, I think. I tried again to copy the site to my dev server getting a similar result as before: Setup -> fields -> FIELD result in a blank page, where you only see the the processwire header and footer. The white part where you are supposed to edit the field is blank. It's the same for modules and templates. The pages tree works as normal but I cant edit templates, fields or modules. Weird ? I get this error when trying to look at the modules page: Warning: count(): Parameter must be an array or an object that implements Countable in [...]/InputfieldFile.module on line 441
  11. Hi, I have an old site that is using the field name 'start'. This is now a reserved word, so I cant update without error. I also can't run the site since its too old. Is there a way I can rename the field in the database so I can upgrade the site? thanks!
  12. Yes, that's one way - but slow. Four words would be a lot of searches, then some PageArray gymnastics to remove duplicates...
  13. When doing an OR search like text~=A|B|C This gives results that contains just "A", as well as "A B C". The results gets ordered in whatever manner they are ordered in the CMS, unless specifically sorted on a field. What I want, however, is to show the results that contain "A B C" first, then the results that contain "A C", "B C", "A B" afterwards, and then finally the results that contain only "A", or "B" or "C" possible? Thanks! Bonus points for being able to de-emphasize filler words like "my", "if", etc. But I realize this might be a bit too advanced?
  14. Yeah, I can see how things leans towards twig and similar. What I run into with twig and the likes is lots of small annoying exceptions: Like, I have to do something with the second last item in a list, for example. My sites are usually quite simple, mostly pulling stuff from the API and showing it. So there isn't enough actual 'logic' to warrant MVC, only simpler "layout logic" (like re-order, truncate, etc). This is why I'm mourning the loss of the (to me) perfect solution of <?foreach():?> One confusing thing is that quite a lot of hosts still allow shorttags with php 7+, just not all..... I'm sure there is a discussion somewhere about shorttags, but it seems it's not 100% consensus that they need to go. But I should probably just get used to some MVC templating ?
  15. Yes, it's not finished. My point is the syntax. I'm looking for a way to avoid having html inside php. In other words avoid this $imgOrCount = '<img src="'. $project->iconimage->size(800,800,['upscaling'=>false, 'cropping'=>false]). '">'; for me personally, this way of writing makes it a bit harder to spot errors (like forgetting a ", or similar). It's just that <?php foreach($projects as $project):?> is a lot less readable than <?foreach($projects as $project):?> if you write a lot of this type of statements
  16. I'm currently doing this. But it makes my eyes bleeeeed. On top of that, sublime can't handle the tabulation properly with this syntax ? <div class="projects"> <?php foreach($projects as $project):?> <div class="project"> <?php if($project->iconimage):?> <?php $thumb = $project->iconimage->size(800,800,['upscaling'=>false, 'cropping'=>false]); ?> <img src="<?=$thumb->url?>"> <?php else:?> <?php $total = count($pages->get('/missingimages')->missingimages); ?> <img src="<?=$thumb->url?>"> <?php endif;?> </div> <?php endforeach;?> </div>
  17. Hi everyone, I just wanted to see what your opinions were on this matter. I'm a big fan of php's template syntax: <?foreach():?> <?endforeach?> It produces nice HTML highlighting. I've notices that some hosting companies removing the support for short tags while upgrading to PHP 7. This makes the template syntax a lot less attractive. What do you use? Am I stuck in the past? Should I just use twig? thank you, j
  18. thanks! yes indeed — very sharp-eyed — that seemed to be causing the problem. not sure i understand fully what you mean with created and saved vs. added. But the created date is used on purpose so that it only happens once.
  19. Hi there, I have the following hook that loops through and overloads a date. It's a template type book page. This page also has the field image. My problem is, with this code I need to save the book page twice for an image thumbnail to be generated - even there is no mentioning of the image field in the code. (I need to press publish, then save). If I only press "publish" once, the 'book' page will not get an image thumbnail. In some way the code below cancels the image generation for this page, but I can't figure out why - or how it's connected..? $pages->addHookAfter('saveReady', function($event) { $p = $event->arguments(0); if($p->template->name == 'book') { $lastcreated = $parent->lastcreated; if($p->created > $lastcreated) { $p->parent->lastcreated = $p->created; } $p->parent->save(); } });
  20. Hi, is there a way I can do something like? $p->find->('sort=-children:eq(0).created,limit='.$limit); In other words, sort by the first childs value of a field. thanks, J
  21. Interesting! times is a repeater with "startdate" (date) "enddate" (date) and "occasion" (string). My function above loops through them to get the earliest start date and latest enddate, and store them in the parent page event, The clients adds a bunch of times (repeater), saves the "event", and then the times are gone. They would have to enter the times again. Now after testing a bunch of times, it does seem to relate to required field: If i skip the required startdate, create 3 times, and press save one of the times was missing. But this only happened twice, then not at all when trying to 10 times more ! Strange, but not the end of the world. But it does seem that the required error message does affect saving a bit.....
  22. tx I'll try that and see if it helps!
  23. Hi there, I have "events" with lots of children "times", to make some queries possible, I copy the earliest / latest time-child into the parent event with this code: This works MOST of the time (99.9%), but the client has been complaining for a long time that this sometimes fails. I've been quite a lot with trying to reproduce the error with no luck. It's maybe because I don't know exactly how hooks work. So, my question is, is this a safe way to do this? Or is it a bad idea to modify a page while saving, like this? $time->startdate is mandatory, but the enddate isn't. Thats why I copy startdate to enddate, if enddate is empty. thanks! $pages->addHook('saveReady', function($event) { $p = $event->arguments(0); if($p->template->name == 'event') { $p->of(false); $enddate = 0; $startdate = 2147483646; foreach($p->times as $time) { if(!$time->enddate) { $time->enddate = $time->startdate; } if($time->enddate > $enddate) $enddate = $time->enddate; if($time->startdate < $startdate) $startdate = $time->startdate; } $p->enddate = $enddate; $p->startdate = $startdate; } });
  24. So I ran into this peculiarity: If I put this piece of code at the end of my 'util.php' (included first on my head.php) — then things work: <? function totallyRandomFunctionName() { /* wire('pages');*/ } ?> Note how wire('pages') is commented out, but it still somehow does the job. Now, if I remove the commented line: <? function totallyRandomFunctionName() { } ?> Then I get this error earlier in util.php, suddenly the wire function isn't existing...: Uncaught Error: Call to undefined function wire() in /xx/util.php:86 Line 86 has: "wire('config')->urls->root" in it. I'm quite curious what goes on here!
×
×
  • Create New...