Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/16/2021 in all areas

  1. @adrian Is the error in your preview window or the editor window? (sounds like preview window, but wanted to double check). wbmnfktr also had a live server where live preview wasn't working, and he set me up with access to test it there. I posted a new version (v3) that includes a non-SSE option and we found that this works on his live server where the SSE option didn't work. Though we found browser cache to be an issue, so had to open dev tools for cache to be disabled at least temporarily. Looks like I need to add a cache buster to the js file. To enable the option in the module settings, make sure you've got the latest posted version (v3) choose "Ajax" for "Enable live preview". Actually it may be pre-selected when you upgrade the module, as I think it's a better default. Make sure your browser cache is clear or that you've got dev tools open, at least if you find it doesn't work at first. I think any web server setup for hosting is likely to have some measures in place to prevent long running PHP scripts just by default. I'm starting to wonder if SSE is just not an ideal solution for a module like this that has to work everywhere. @kongondo I was only making a guess, thinking that SSE has some native performance benefit. Now that I've implemented the communication between windows (The "Enable live preview > Ajax" option) I find it does seem like it's faster than when using SSE, though I've not benchmarked anything yet.
    5 points
  2. This is what I do, which is almost like (2). site/config.php: <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); // Other PW default config values... // ... $config->dbHost = 'localhost'; $config->dbName = 'example_site'; $config->dbUser = ''; $config->dbPass = ''; $config->dbPort = '3306'; $config->dbCharset = 'utf8mb4'; $config->dbEngine = 'InnoDB'; // Environment overwrite if (file_exists(__DIR__ . '/config.local.php')) { require_once(__DIR__ . '/config.local.php'); } config.local.php: <?php namespace ProcessWire; $config->dbUser = 'example_site_user'; $config->dbPass = 'example_user_pass_123456'; config.local.php is in .gitignore, so never committed, and separate config.local.php files exist on testing / live environments. (I use DeployHQ and this is added as a config file that gets deployed with the rest of the code). To me, the benefits of this approach means that the entire config can be changed depending on the environment, and used to turn things on or off, like debug or advanced mode.
    5 points
  3. The newest posted versions of PageAutosave (v3 and v4 in ProDevTools, ProDrafts, ProFields) adds the following: Support for alternate event driven ajax live preview mode, which appears to provide improved performance and work in live environments where the streaming/SSE didn't. Since this seems to work better, it is the new default setting. The SSE option is still there but you have to manually select it in the module settings if you want it. Support for remembering live preview window position, plus automatically detecting and using an optimal preview window position. Meaning, it'll find the location on the screen where there is the most room for the preview window and then move and resize it there. Once the window is in position (or if you move or resize it) it'll remember your setting in a cookie so that you won't have to move and resize your live preview window every time you edit another page. Automatic insertion of pw-value-* classes in markup to support replacement of individual fields native to $page, without having to re-render the page. This means you no longer have to insert your own pw-value-* classes in markup for improved performance, as the module will do it for you when rendering a live preview request. If it causes any issues with your site, you can optionally turn off the feature in the module settings.
    4 points
  4. htmx supports using morphdom for swapping with the morphdom-swap extension agree 100% w/ @Craig's characterization of htmx as lower level than unpoly: it's an extension of HTML rather than a full framework (with, for example, a notion of layers). That can be good or bad, depending on your needs. Unpoly is a wonderful library that follows the same general html-oriented approach, but provides a lot more infrastructure baked into the core. I think either one (or, hotwire, for that matter, which is even higher level than unpoly) is a great choice for html-oriented development. I obviously prefer the lower-level "improve on HTML" approach, but they all have plusses and minuses. I'm (all to) happy to chat about htmx either here, on the htmx discord, or anywhere else. -t.totallyNotAnHtmxShill
    4 points
  5. You could also use Matomo analytics (open source), which keeps track of site search keywords and searches with no results, as well as the most common pages visited as a result of a site search. I reckon it’s ok to log searches to a file in ProcessWire as well. I was previously logging searches with no results to the messages log with: wire('log')->message("No results for $searchTerms"); Or to log all results to a separate search log with: wire('log')->save('search', $searchTerms); Because the log files are saved in a consistent space-separated format they'd be possible to parse with a script (maybe reporting the results through a ProcessWire page), or import into a spreadsheet program. We use the paid Form Builder module to allow users to answer a 'was this page helpful' question at the bottom of any page, including search. Another way of recording the success of the search could be to put the results through an intermediate PHP script that logs the search position of the chosen search result, before redirecting users on to the actual result. So you could see if the first match is mostly chosen, or something further down the list.
    3 points
  6. Hi @heldercervantes Why just not use Google Analytics for that? https://www.optimizesmart.com/tracking-site-search-get-based-search-engines-google-analytics/ https://www.lovesdata.com/blog/site-search-reports
    2 points
  7. @wbmnfktr Thanks for the pointers! The hoster is All-Inkl. in Germany, so no fancy cloud service. PW logs don't say much, just: this request was aborted because it appears to be forged Unfortunately the client doesn't live nearby, so no chance of dropping by and checking myself. At some point he will get frustrated and eventually agrees to use some sort of Teamviewer with me. My gut feeling says inhouse routing, AntiVirus program or VPN, but my guts are old now...
    1 point
  8. Only ideas so far... based on some experiences in the past ... VPN or internal routing issues Adblocking, Privacy Extensions messing with cookies, IP, Browser string Cloudflare CDN (website) and Cloudflare DNS (client) don't work well together Cloudflare CDN caching issue (page rule needed to exclude PW-backend) Using the site with developer tools / device preview enabled IPv4/IPv6 issues either on client or server side AntiVirus or Internet Security software Check the PW logs (maybe even the server logs) to see what was happening when the client was trying to use the site just to get a clue. Something like: Error: Session fingerprint changed (IP address or useragent) (IP: 127.0.0.1) I had one client that used Opera with the built-in VPN. Took us quite some time to find this out as we both didn't know it even existed or was enabled. After disabling it the problem never occured again.
    1 point
  9. Hi, as Robin said, so far it's not a native pw selector and, being a great fan of sql queries i do like his solution ? now if you want to take advantage of what pw gives you with selectors, you can just add a numeric field to the templates you want to find name it as you want (i'll use titlelength for my example) in the field tab of the... field set it as hidden then in your ready.php file put something like this (the namespace is just here in case you don't have a ready.php file for the moment) <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); $pages->addHookAfter('saveReady', function($e) { $p = $e->arguments(0); if($p->template != 'template_to_play_with') return; // you could also use an array of templates to exclude and if (in_array($p->template, $your_array)) $ln = strlen($p->title); $p->set('titlelength', $ln); }); now you can filter using titlelength>10 hope it helps have a nice day
    1 point
  10. Welcome to the PW forums ? PW doesn't currently provide a way to find pages by the length of a field value. Although I think it would be a nice feature so I took the liberty of opening a request: https://github.com/processwire/processwire-requests/issues/424 Technically you could achieve it with a custom SQL query: $sql = 'SELECT pages.id FROM pages LEFT JOIN field_title ON field_title.pages_id = pages.id WHERE CHAR_LENGTH(field_title.data) > 10 AND pages.templates_id != 2 AND pages.parent_id != 2 AND pages.parent_id NOT IN (SELECT pages_id FROM pages_parents WHERE parents_id = 2 OR pages_id = 2)'; $ids = $database->query($sql)->fetchAll(\PDO::FETCH_COLUMN); $results = $pages->getByIDs($ids); But you might find it simpler to stick with what you're already doing.
    1 point
  11. Hi, if you look at the plugin js source code, you'll see its dependencies requires: 'api,widget', and, downloading those ckeditor addons, you'll see widget has quite a lot too so, first, you'll have to download those https://ckeditor.com/cke4/addon/api https://ckeditor.com/cke4/addon/widget https://ckeditor.com/cke4/addon/clipboard https://ckeditor.com/cke4/addon/notification https://ckeditor.com/cke4/addon/lineutils they are not default plugins installed in pw then, well, i suppose you've put the detail plugin files in a... detail folder in your /site/modules/InputfieldCKEditor/plugins folder, do the same with all those plugins folders too but it's not finished ? go to your ckeditor field input tab and allow all those plugins and, afterwards but considering your post i think you've already done this, add Detail to your ckeditor toolbar, job done ? ckeditor is highly configurable but it's not always that simple ? have a nice day
    1 point
  12. How much slower are we talking? In my mockup, the one with the htmx only I talked about earlier, the communication between the windows was quite fast. I don't know, however, how your implemented your communication.
    1 point
  13. Great, thank you so much for the quick fix. Everything working smoothly and I'm having fun again working with the console. Yeah, I thought that the monospace option should take care of that, too. But, obviously, this was not the case. Cheers
    1 point
  14. Hi @teppo thanks for your help! I finally found out what was wrong. My logs showed "Error: Exception: Unrecognized operator: +" and then I realized I had some "example code snippet" which was not fully commented out the right way and therefore caused problems. Before the update processwire was probably ignoring that failure but the newer version may not.
    1 point
  15. Hi @gebeer - thanks for taking the time to debug. I actually only ever see that if I have an emoji character in the console. Regular characters don't cause that for me, but maybe that is environment based. I've added Courier New for you, but I would have though that the "monospace" option at the end would have taken care of things in any environment. I have also updated ACE to the latest version. Let me know if you have any more troubles with it.
    1 point
  16. Thanks, I already put the memory_limit to 320MB which didn't help. It works on my test-installation though, which however has a smaller database. So I guess if setting the RAM to 512MB works, that solution would only be temporarily as well. Any more ideas?
    1 point
  17. Hi @ctech, Sorry for the very late response. Maybe something like below to get you started? I have deliberately left in debug code so you see what's going on. I am also using findRaw() for efficiency. You can go a bit crazy with limit if using findRaw() ?. <?php namespace ProcessWire; // we only need this one field $fields = ['blog_date']; // get some posts, sorted by date, ascending $posts = $pages->findRaw("template=blog-post, sort=-blog_date, limit=25", $fields); bd($posts, '$posts at line #' . __LINE__); $posts2 = []; // if we got results, format and use them if (!empty($posts)) { // make it clean (not strictly necessary) $posts2 = array_column($posts, 'blog_date'); bd($posts2, '$posts2 at line #' . __LINE__); $monthArchives = []; foreach ($posts2 as $dateString) { // get the month portion of 'blog_date' $month = $datetime->date('F', $dateString); // get year portion of 'blog_date' $year = $datetime->date('Y', $dateString); bd($month, '$month at line #' . __LINE__); bd($year, '$year at line #' . __LINE__); $monthArchives[$month][$year] = $year; // @TODO: DON'T KNOW WHAT YOU WANT THE VALUE TO BE HERE } bd($monthArchives, '$monthArchives at line #' . __LINE__); } // do something with $posts2 if (!empty($posts2)) { // code } Hope this helps ?.
    1 point
  18. ProcessWire will generate directory-specific .htaccess files automatically unless a) they already exist or b) it doesn't have write access to these directories. While access restriction is what I'd recommend as a general best practice (in my opinion the system should never have write access to anywhere it isn't strictly necessary), that may require more tweaking than you're ready to go through. This leaves us with the first option. You could achieve this by making sure that you have empty .htaccess files in following directories: /site/assets/ /site/assets/logs/ /site/assets/cache/ /site/assets/backups/ /site/templates/ /site/ /site/modules/ If the files are empty, they should not affect anything, so... problem solved ? Note that the reason I was asking what the path of the file is is that if .htaccess files in question are blocking access to it, there's likely a reason for that — i.e. it's in a directory that isn't supposed to be directly accessible. It would be best to check where it is, and why it is there in case that turns out to the problem.
    1 point
  19. Repeaters are output as PageArray (or rather a class that inherits from it, called RepeaterPageArray), so you have all the methods from a WireArray such as: https://processwire.com/api/ref/wire-array/get/ https://processwire.com/api/ref/wire-array/find/ $page->repeater_field->get('FieldA=2')->FieldC
    1 point
  20. et voilà - I made a little mock-up
    1 point
  21. There is start? $posts = $pages->find('template=news, sort=-created, start=80, limit=40');
    1 point
  22. Can I put this code in head.inc ? <select onchange='window.location=$(this).val();'> <?php foreach($languages as $language) { $selected = ''; // if this page isn't viewable (active) for the language, skip it if(!$page->viewable($language)) continue; // if language is current user's language, make it selected if($user->language->id == $language->id) $selected = " selected=selected"; // determine the "local" URL for this language $url = $page->localUrl($language); // output the option tag echo "<option$selected value='$url'>$language->title</option>"; } ?> </select>
    1 point
×
×
  • Create New...