Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/12/2018 in all areas

  1. I was wondering how to override the style on a PW form only to find I posted the solution above 2 years ago ??
    5 points
  2. I'm in the middle of uploading them. ? They'll be perfected by the end of the day.
    5 points
  3. That works if you choose the %= selector (SQL Like) https://processwire.com/api/selectors/#operators
    3 points
  4. You need to target a specific page, in this case the Home: $pages->get(1)->httpUrl This will get the page on the language the user is browsing the site, which is what you need I guess.
    2 points
  5. Here's a try: <?php echo (selectorsMatch("baths>1, template=listing", "template=listing, baths>1")) ? "Match" : "No match"; function selectorsMatch($sel1, $sel2) { $s1 = new Selectors($sel1); $s1->sort('field'); $s2 = new Selectors($sel2); $s2->sort('field'); return "$s1" == "$s2"; } Not sure how this behaves with OR-groups, but it should be fine for simple AND selectors.
    2 points
  6. That will do the trick, Thanks @Jonathan Lahijani I knew I could just use curl but if there is anything I've learnt it's ProcessWire always has an easier solution ?
    2 points
  7. have you tried logging the POST request to both the URL and the URL with the Segment - it should be the same unless somehow URL segments are not activated on that template. The idea should work, I can't think of any reason why segments would not work on an ajax service page; if you keep hitting up against issues you could go for query parameters instead. You may also need to check if there is a URL segment present, like if(strlen($input-urlSegment etc.. ; and make sure to also do the regular sanitization of the $input, as well as return 404 for unused segments...
    2 points
  8. WireHttp might be one solution. https://processwire.com/api/ref/wire-http/
    2 points
  9. Find queries are cached for the lifetime of a request. Caching them more permanently needs additional code. I think there was an example for using MarkupCache to store JSONified query results in the forum a while ago, but I might remember wrongly. With highly dynamic sites, everything you know about caching best practices is at first no longer valid. Until you start factoring out the dynamic parts, that is. Decouple searches from the database by using a dedicated in-memory search engine (Lucene, OpenSearchServer etc.) to avoid high loads and table level locks. Cache IDs and values retrieved from frequent searches in memory (like newest n posts/comments), and when you scale up, delegate the job of updating those to cronjobs to eliminate any delays caused by rebuilding expired memory caches. Retrieve dynamic parts of the page through JS in JSON format and render them with a frontend framework so the static parts and templates can be served from the filesystem (that's where ProCache ties in). Design your pages to use placeholders for dynamic content so your users don't have to wait for client side rendering of dynamic content before they can start using the page.
    2 points
  10. Check out @Jonathan Lahijani's new series of PW vs WP videos: https://www.youtube.com/channel/UCAzZwO7DZ91tQmZqZwe5vuQ
    2 points
  11. Hi, After reading this thread, I decided to make a module that helps generating PDF files of ProcessWire pages. GitHub: https://github.com/wanze/Pages2Pdf Modules Directory: http://modules.processwire.com/modules/pages2-pdf/ This module uses the mPDF library to generate the PDF files. It has fully UTF-8 and basic HTML/CSS support for rendering the PDF files. The output is customizable with ProcessWire templates. Example I've enabled generating PDF files for the skyscraper template of ryans Skyscrapers-profile with a template that outputs the data in a table along with the body text and the images: one-atlantic-center-pdf-4177.pdf Please take a look at the README on GitHub for instructions and further information/examples. Cheers
    1 point
  12. --- Please use RockFinder3 ---
    1 point
  13. Thanks, fixed in v197. There are other places where there's no need to add but thankfully we have $page->trashable().
    1 point
  14. If @BitPoet's description is fitting for the intended project I'd say there might be more fitting tools out there than ProcessWire (also depending on your skillset though). It's a great CMS and you can make it work in a lot of situations, but it does have it's issues at bigger scale projects like being quite prone to n+1 queries if you're not cautious and pitfalls like getting into trouble with a great diversity in templates/fields because those are all loaded on each request. Caching can help in places, but dynamic content is hard to cache and personally I'd always look for the options, where you can get away without caching first before depending on it working out elsewhere.
    1 point
  15. @adrian If you use the custom Google search in my sig, you'll find a lot of nginx forum threads. One of the oldest is this one, with Ryan chiming in with tips... https://processwire.com/talk/topic/275-processwire-on-nginx/ @jturley Likewise, searching for "bad gateway" or DigitalOcean, you'll find a few other forum posts - some of them mention some special, problematic mySQL versions, others point to some special DB configs...
    1 point
  16. Sorry this is going to be vague but... I've hacked it to support floats in some projects. It's not too hard. Just had to look in the module's code where the fields are defined and it's relatively easy to find the INT and change it to float. You may have to do the same in the DB as well. Takes some fiddling. I wish I could be more specific, but after formatting my machine I'd have to go through a bunch of backups to find actual code.
    1 point
  17. I created a Discord Server for anyone to step by and say Hello ? https://discord.gg/3jCQgt5
    1 point
  18. You already have part of the logic for this - now you just need the else. I would tend to flip the logic around the other way though... if($p->id) { // $p is an existing page, so prepare it for saving new field values $p->of(false); } else { // No existing page so create one $p = new Page(); // ... } // Now set the field values of $p Keep track of the job ids in the RSS feed using an array. Then find any pages with job ids that are not in the array and delete them. $job_ids = []; foreach($rss as $item) { $job_ids[] = $item->id; // The rest of your code... } // Implode for use in selector string $job_ids = implode('|', $job_ids); // Find pages for deletion $delete_pages = $pages->find("job_id!=$job_ids"); foreach($delete_pages as $delete_page) { $delete_page->delete(); }
    1 point
  19. Note: I believe WireCache is the successor of MarkupCache (which is unofficially deprecated?). From this blog post (April 2015): https://processwire.com/blog/posts/processwire-core-updates-2.5.28/
    1 point
  20. Solved this problem for one of my sites today with this three steps: Changed the page name of the new homepage into "home" (because of the navigation) Inserted this code into the old home.php template file: echo $pages->get(1234)->render(); // "1234" is the page id of the new home page Inserted this code into the config.php: $config->guestUserPageID = 1234; // "1234" is the page id of the new home page It works perfect. Even with segmets if the old homepage template has switched on "allow URL segments". Just want to share this one ...
    1 point
  21. "waiting for table level lock" would suggest that something is odd on the server side and/or mySQL. Maybe mySQL doesn't have enough memory, or is being re-booted every now and then, and can't handle the queries fast enough. Perhaps switching from myISAM to InnoDB would help already. Or maybe this is being caused by a large mysqldump process https://superuser.com/questions/1093610/mysql-5-7-stuck-forever-waiting-for-table-level-lock
    1 point
  22. Things are slowly stabilizing and I am thinking about releasing a "Preview" Version this or next week. Since it is a "setup" and not only a Module I would like to make the entire demo-site downloadable using Duplicator for example. Duplicator has it's own setup procedure, so this should be easy for everybody. My question is about legal stuff. Is it OK to include the wire folder (PW 3.0.105) and modules like AOS etc. in a downloadable Duplicator Zip File? Thank you.
    1 point
  23. https://github.com/processwire/processwire-requests/issues/198
    1 point
  24. Does this help? $this->addHookBefore('ProcessPageEdit::processInput', function($e) { if (wire('input')->post('submit_save')) { $e->message("This page has been saved by pressing the 'Save' button."); } });
    1 point
  25. Although Drupal specific, https://www.chapterthree.com/blog/slice-template this explains the concept of page slices. "It’s a design structure that enables site authors to create web pages out of modular, horizontal components that span the width of the browser." Basically I was just wondering if what you were making would allow an editor to build these page slices that contain columns that contain components/widgets?
    1 point
  26. Delayed output is not about concatenation but storing rendered html in a variable to be output later on. Eg: <?php $output = wireRenderFile("./partials/partial.php", array('page' => $page)); //lost of other code :) echo $output; Ryan prefers concatenation to wireRenderFile. I prefer wireRenderFile to concatenation, for example.
    1 point
  27. Maybe I don't fully understand the term headless, but I would have thought that PW is ALWAYS headless, even with our typical way of using the API. Surely headless doesn't just mean delivery via JSON etc, but rather simply no forced output. I have used PW in the "regular" way for websites, but also as a JSON source for SPA web apps and mobile apps. In my mind, these are all headless, but maybe I I still don't get it, or maybe that is actually what you are saying anyway
    1 point
  28. Of course. In one of your templates (edit: In one of your template files) you simply do <?php echo $modules->get('ProcessGraphQL')->executeGraphQL(); and that's it. It will handle all GraphQL requests. There is more info in the repository.
    1 point
  29. @adrian @kongondo I tried that to no avail! I was excited to use that method, but it resulted in a 404 every time, no matter how I attempted to configure it.
    1 point
×
×
  • Create New...