Jump to content

dragan

Members
  • Posts

    2,007
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by dragan

  1. I don't think it would resolve the issue. SHDB just saves to DB instead of the file-system. But PHP will still do one session request after another and probably uses db table locks instead of file locks (at least that's my guess). Are you using PW session functions or native PHP? Towards the bottom of this article there is PHP 7 option: session_start([ 'read_and_close' => true, ]); https://ma.ttias.be/php-session-locking-prevent-sessions-blocking-in-requests/ The author also mentions Redis (there's also a redis session handler db module for PW), but if you're not using it it won't be of much use...
  2. Well, if you're using several videos, this won't work. But you could simply add the two video URLs in data-attributes. <video id='video' data-src-720="<?=$page->video_720->url?>">...</video> <video id='video' data-src-1080="<?=$page->video_1080->url?>">...</video> You could even get rid of IDs altogether. Just create a JS function that sets each video src on resize / window load with reading out the data-attributes. https://www.sitepoint.com/use-html5-data-attributes/
  3. similar problems were reported here: google error-msg site:.processwire.com, e.g. SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data site:.processwire.com
  4. I guess it's possible, but of course not optimal. Maybe try this? https://www.drupal.org/docs/8/modules/json-api/json-api i.e. fetch JSON feeds from Drupal, and import to PW with file_get_contents() + json_decode()
  5. I just tried this and it works as expected: $highestID = $pages->get("template=user, sort=-id, limit=1, roles=intern")->id; echo $highestID; in your case, you'd have to replace id with customer_number, and use your specific role anzeigen-anbieter.
  6. You could check existing users with the role anzeigen-anbieter, get the highest customer_number, and add 1 for your new customer. $pages->find('template=user,sort=-id,limit=1,roles=anzeigen-anbieter');
  7. Do you mean that all 5 images are actually stored? But you can only see 2 of them after uploading, in page-edit view? Check the logs: site\assets\logs - maybe you'll find a hint.
  8. Is the frontend still working fine? You could try this:
  9. Do you see anything suspicious in the browser JS console? (errors, warnings, 404...)
  10. @gmclelland Basically, what I did is installing this module: https://processwire.com/api/modules/lazy-cron/ Then I added this one line at the very bottom of my "search-input" template (the only place I need to ever access that index JSON): wire()->addHook('LazyCron::everyHour', null, 'cronAutocompleteJSONCache'); In file _cron.php, that I include_once("./_cron.php"); in my search-input template, I have this: <?php namespace ProcessWire; function cronAutocompleteJSONCache(HookEvent $e) { $selector = "parent=1041, has_parent!=2"; $matches = wire('pages')->find($selector); foreach ($matches as $match) { $result = array( "title" => htmlspecialchars_decode($match->title), "year" => $match->year, "project_desc_short" => htmlspecialchars_decode($match->project_desc_short) ); $results[] = $result; } $cacheHolderPage = wire('pages')->get(10029); $cacheHolderPage->setOutputFormatting(false); $cacheHolderPage->autocomplete_json = json_encode($results); $cacheHolderPage->last_update = date('d.m.Y h:i:s'); $cacheHolderPage->save(); } Of course, I could have also saved the JSON on the file-system, and check the timestamp, and decide on every request if the static JSON is older or newer than the PW-content, and load/generate one or the other, but for my needs, this seemed like the easiest and most straightforward solution. PS the field last_update I have only added for myself to see if it really works. I made it a "read-only" field in the settings. (not editable)
  11. Can you post your entire code (or at least the relevant bits)? That's simply how sessions work. You can't set new session vars and retrieve them in one go. From http://php.net/manual/en/features.sessions.php The keyword being "subsequent"
  12. Turns out I was using a selector that didn't work... I basically used the same one I use for regular search. In the end my selector just needed to define the parent, that was all. It all works nicely now. I've added a little LazyCron task too: I save the JSON in certain intervals to a (hidden) PW page/field, and only query this JSON data with JS. It really speeds things up. Otherwise (with browser cache cleared) I had to wait a few seconds till the suggestions were loaded. Thanks again for your help, suggestions + patience @AndZyk
  13. Does anybody know if Inputfield Dependencies work with page reference fields? I tried using it today with PW 3.0.72 and it didn't work: show this field only if... service=1237 service=name-of-service service='title of service' Sadly, this part hasn't been updated:
  14. Thanks for your help. I now removed the Pages2JSON module altogether. If I allow display in the browser, i.e. remove if ($config->ajax) I can see the JSON neatly and quickly displayed in the browser. However, When using it in my search-form, it's not doing anything. It calls my autocomplete page, but when I check the contents in Google Chrome > Network > XHR, it's always empty. Status code 200, but no content. My JS looks like this: var actionURL = '<?=$autompleteURL?>'; // Save form action url in variable $.typeahead({ input: '#q', hint: true, dynamic: true, debug: true, display: ["title", "project_desc_short"], source: { url: actionURL // Ajax request to get JSON from the action url }, callback: { // Redirect to url after clicking or pressing enter onClickAfter: function (node, a, item, event) { // window.location.href = item.url; // Set window location to site url // console.log(item.url); } } }); I've added dynamic: true + debug: true hoping it would give me some hints, but I don't get JS errors either. Do you have any idea what I've been missing?
  15. Actually, I tried it again, and now get at least some output... but not really what I expected: <br /><b>Warning</b>: Missing argument 1 for Pages2JSON::___getFields(), called in /home/xxxx/www/xxxx/xxxxxx/site/assets/cache/FileCompiler/site/modules/Pages2JSON/Pages2JSON.module on line 182 and defined in <b>/home/xxx/www/xxx/xxxxx/site/assets/cache/FileCompiler/site/modules/Pages2JSON/Pages2JSON.module</b> on line <b>185</b><br /> o_O
  16. Thanks @AndZyk Thanks for your tutorial! I actually found your thread too, shortly after posting here. I think I did everything right, but strangely, the JSON never returned anything. No JS or PW errors either. Today I realized I had an old version of Pages2JSON installed, so I updated it. Unfortunately the update didn't keep my fields in the settings. When I get some time to try it again, I'll post back here.
  17. Well, considering the numbers, it's actually not a big surprise... bottom of https://wpisnotwp.com/ And like with most things, people who have never seen / used anything else, they can't even imagine that there's so many other options out there. Another reason is perhaps that those people in charge of choosing a CMS are hardly ever the people who have to use the system. The people who have to use a CMS on a daily basis are almost never asked about their opinion. Mostly, it's just a tiny part of their job, which they loathe. It's probably dull copy-and-paste-from-Word, 9 times out of 10.
  18. Has anyone built an autocomplete / autosuggest search in the frontend with PW? I found a few threads, but they're mainly focussing on PageAutocomplete. I got a search form already which is working fine (regular HTML), but how do I build an index that I could use as JSON source? Would it be wise to create a cron job to re-build the index (performance)? The system would be used by a small number of users (max. 1-2 dozen at the same time). There are about 1200 pages and 4 dozen fields I search through. I'd appreciate suggestions / links.
  19. OK, so I guess this is definitely a facepalm Friday... I was playing around with hooks lately. And one of those hooks created emails to notify me whenever a certain page-type was edited/created. Today, I had to create several pages via API. Worked out all nicely and all... till I realized that I have also sent out some 20k email notifications. Within 1-2 hours. This of course notified the hosting company, and they disabled WireMail altogether. After a phone call with the hosting company, they put the chmod back to 0644. I disabled that hook and everything is smooth sailing again... Feel free to add your own personal favorite facepalm.gif here... mea culpa... and TGIF!
  20. I'm suddently getting this error message whenever I want to edit a page: Error: Class 'ProcessWire\WireMail' not found (line 58 of /home/somedir/www/foo/wire/core/WireMailTools.php) It results in server error 500. I'm certainly never touching anything in the wire folder, the WireMail files are all there. Has anybody an idea what causes this? I'm practically blocked.
  21. Excellent! Thanks a lot. Will try it this weekend.
  22. Thanks! I tried a11ychecker and AccessibilityChecker instead... behold, the joys of case sensitivity
  23. In page-edit mode, it would be nice to have an optional download-button for inputfield type file. i.e. when a user has uploaded two dozen files (perhaps through the frontend), and someone else needs to download these from the backend all at once, without having to open an FTP client. There would simply be a download link / button, and a ZIP would be generated on the fly, containing all files. If someone has an idea how to do that (a hook?), I'd be all ears
  24. I wanted to install the CKEditor accessibility checker on one of my sites (latest PW 3 dev). I downloaded the two required folders and put them in the correct folder (as per the helptext To add more plugins, place them in /site/modules/InputfieldCKEditor/plugins/[name]/, replacing [name] with the name of the plugin.) I checked those two plugins in the body field (which means PW recognises them) under edit field > input. I even tried to put the plugins in wire/modules/Inputfield/InputfieldCKEditor/plugins - which of course is stupid, but hey... worth a try. And I made sure i hit "refresh modules" a couple of times as well... Does anyone know why that new plugin still doesn't show up in my field?
×
×
  • Create New...