Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/18/2019 in all areas

  1. my preferred way is to make a generic 'service' template, and have a 'services' index page, under which you can add as many services/ajax endpoints as you want; then you just have the template include the correct service php file by matching the name; in any given service file, you can do a return $this->halt() or exit() to stop the appending; you can also just turn off prepend/append for that service template and you'd be all set... that's risky and not so future proof; also on some templates it might prevent you from doing some processing before the head loads, for that template – maybe add a dns prefetch to the header, or a custom script or style for that template's pages. if you don't have a lot of templates, it is probably better to just include head and foot in each template file and skip the auto prepend/append. The benefit of using pages for your endpoints is that you have full native access to the api, and no bootstrapping necessary..
    6 points
  2. Probably one of the $sweepstake_children doesn't have any images. Probably best not to rename the images within the page because that results in the loss of potentially useful filename data and would break any links to the images within CKEditor fields. Instead you could copy the files to a temporary directory, renaming them in the process, then create the zip and download from there. Here is some code you can adapt for your purpose: // Create temp directory $td = $files->tempDir('to-zip'); $td_path = (string) $td; $files_to_zip = array(); foreach($page->children() as $child) { $image = $child->images->first(); // Continue if no image exists if(!$image) continue; // Set path including new filename as needed $new_path = $td_path . "{$child->id}.{$image->ext}"; // Copy image to new path $success = $files->copy($image->filename, $new_path); // Add new path to array if($success) $files_to_zip[] = $new_path; } // Set destination path for zip file $zip_path = $td_path . time() . '.zip'; // Create zip file $success = $files->zip($zip_path, $files_to_zip); // Send download if($success) $files->send($zip_path); // Optionally remove temp directory now rather than waiting for it to automatically expire $td->remove();
    4 points
  3. In this post we take a quick look at the new version of ProFields Repeater Matrix, yet another new version of FormBuilder, and a new version of the GoogleClientAPI module— https://processwire.com/blog/posts/lots-of-module-updates/
    3 points
  4. @HerTha I use such code: if (input('get', 'q')) { $query = input('get', 'q', 'text'); input()->whitelist('q', $query); $selector = [ ['template', 'post'], ['title|builder.post_wysiwyg|builder.blockquote_wysiwyg', '%=', $query], ['limit', '10'] ]; } and it also works with '!' without errors. Consider using selectors as arrays as it more clear way and have on a small benefit that you don't have to use $sanitizer->selectorValue()
    3 points
  5. Thanks @Zeka, that makes a big difference, reducing the time taken to less than half of what is was previously. And thanks also @Autofahrn, that sounds a really interesting approach to improving performance further. The system is already quite well established, so I probably can't switch to having each image on a page (or at least not easily), but some variation on your idea might work well. For example, hooking on image load and storing relevant data (such as the time of the most recent image load) in a field on the page or some similar approach might work. And @Zeka, the SQL and RockFinder ideas seem interesting too. I now need to close down for the day, but I'll look into all these further over the next day or so.
    3 points
  6. 1. If you put your PHP file in the site root it won't be affected by the htaccess restrictions. You could also put it any other place besides those places with restricted access. 2. See the "Files" tab in the template settings: "Disable automatic prepend of file..." / "Disable automatic append of file..."
    3 points
  7. Imagine you have a nice conversation with someone and only a few hours afterwards you are knee-deep into a module and possibilities you never thought of. Thank you @bernhard for hijacking my plans for the weekend. ?
    3 points
  8. Just had a very interesting conversation with @wbmnfktr and wanted to share this little preview of a quite big upgrade coming soon called "RockGridActions". I'll share some more infos soon. The great thing about it is that it is built modularly so that we'll be able to use it almost plug&play for RockTabulator ( @Beluga)
    3 points
  9. @SoccerGuy3 Glad that it helped. The name of your button is not 'submit', but 'submit_name', but in your initial code you check '$this->input->post->submit'. $f->attr('name', 'submit_save'); Also if you want to make your code more PWish you can rewrite it with https://processwire.com/api/ref/wire-database-p-d-o/
    2 points
  10. @arjen quickly seeked the log and do not found anything wrong. In that log closing happens at 0.5s and opening at 2.7s so everything seems to work fine a the time between close and open indicates the time for zip operations to take place. You may give it a try and place the backups in some other location (i.e. next to the .../public folder or in .../public/backup), but I doubt this helps, since the logfiles are there. I can only guess that the $zip->close() fails for some reason, so please try changing that block to read: $zipLog->verbose("CLOSING ZIP: {$zipfile}"); $res = $zip->close(); if($res !== true) { $zipStatus = $zip->getStatusString(); $zipLog->verbose("CLOSE ZIP FAILED: {$zipStatus} in {$zipfile}"); throw new WireException("Unable to close ZIP ({$zipfile}): {$zipStatus}"); } $zipLog->verbose("OPENING ZIP: {$zipfile}"); Since I expect the close to fail I've read the complete log and saw, that it tries to zip temporary files generated by ProCache. So its probably worth to add an exclude for ProCache: %/ProCache-[^/]+$% # Ignore ProCache directory and maybe the pwpc directory as well: /site/assets/pwpc/ Edit: forgot that exclusion directories must be site-relative (so its /site/assets/pwpc/ not /pwpc/)
    2 points
  11. SnipWire - Snipcart integration for ProcessWire Snipcart is a powerful 3rd party, developer-first HTML/JavaScript shopping cart platform. SnipWire is the missing link between Snipcart and the content management framework ProcessWire. With SnipWire, you can quickly turn any ProcessWire site into a Snipcart online shop. The SnipWire plugin helps you to get your store up and running in no time. Detailed knowledge of the Snipcart system is not required. SnipWire is free and open source licensed under Mozilla Public License 2.0! A lot of work and effort has gone into development. It would be nice if you could donate an amount to support further development: Status update links (inside this thread) for SnipWire development 2020-07-03 -- SnipWire 0.8.7 (beta) released! Fixes some small bugs and adds an indicator for TEST mode 2020-04-06 -- SnipWire 0.8.6 (beta) released! Adds support for Snipcart subscriptions and also fixes some problems 2020-03-21 -- SnipWire 0.8.5 (beta) released! Improves SnipWires webhooks interface and provides some other fixes and additions 2020-03-03 -- SnipWire 0.8.4 (beta) released! Improves compatibility for Windows based Systems. 2020-03-01 -- SnipWire 0.8.3 (beta) released! The installation and uninstallation process has been heavily revised. 2020-02-08 -- SnipWire 0.8.2 (beta) released! Added a feature to change the cart and catalogue currency by GET, POST or SESSION param 2020-02-03 -- SnipWire 0.8.1 (beta) released! All custom classes moved into their own namespaces. 2020-02-01 -- SnipWire is now available via ProcessWire's module directory! 2020-01-30 -- SnipWire 0.8.0 (beta) first public release! (module just submitted to the PW modules directory) 2020-01-28 -- added Custom Order Fields feature (first SnipWire release version is near!) 2020-01-21 -- Snipcart v3 - when will the new cart system be implemented? 2020-01-19 -- integrated taxes provider finished (+ very flexible shipping taxes handling) 2020-01-14 -- new date range picker, discount editor, order notifiactions, order statuses, and more ... 2019-11-15 -- orders filter, order details, download + resend invoices, refunds 2019-10-18 -- list filters, REST API improvements, new docs platform, and more ... 2019-08-08 -- dashboard interface, currency selector, managing Orders, Customers and Products, Added a WireTabs, refinded caching behavior 2019-06-15 -- taxes provider, shop templates update, multiCURL implementation, and more ... 2019-06-02 -- FieldtypeSnipWireTaxSelector 2019-05-25 -- SnipWire will be free and open source Plugin Key Features Fast and simple store setup Full integration of the Snipcart dashboard into the ProcessWire backend (no need to leave the ProcessWire admin area) Browse and manage orders, customers, discounts, abandoned carts, and more Multi currency support Custom order and cart fields Process refunds and send customer notifications from within the ProcessWire backend Process Abandoned Carts + sending messages to customers from within the ProcessWire backend Complete Snipcart webhooks integration (all events are hookable via ProcessWire hooks) Integrated taxes provider (which is more flexible then Snipcart own provider) Useful Links SnipWire in PW modules directory SnipWire Docs (please note that the documentation is a work in progress) SnipWire @GitHub (feature requests and suggestions for improvement are welcome - I also accept pull requests) Snipcart Website ---- INITIAL POST FROM 2019-05-25 ----
    1 point
  12. @Autofahrn thanks for your input! Initially, I thought I am dealing with a general problem. Now, it seems more related to a special combination of details. @Zeka array syntax looks good - worth trying, I'd say! I'll report back once I find more...
    1 point
  13. Seems like your $sanitizer->selectorValue() does not work at all for some reason. Could you check with Tracy? $search_term = '!'; $val = "template=contentpage,title|headline|body%={$sanitizer->selectorValue($search_term)}"; d($val); Should output: "template=contentpage,title|headline|body%="!"" (45)
    1 point
  14. Thank you, everyone! These are helpful strategies and I will integrate them into my work. What a great community. Regarding the auto-pre/appending, this is documented on the PW (https://processwire.com/docs/tutorials/how-to-structure-your-template-files/) as Direct Output with Automatic Inclusions, but I know Delayed Output and Markup Regions are probably preferred and I will work on switching to those strategies.
    1 point
  15. @BillH Also if you are familiar with SQL you can get recent images directly from DB with one query and then find corresponding pages if you need some information from them. There is RockFinder module that can perform faster searches in some scenarios (complicated dashboards etc.)
    1 point
  16. @BillH, I'd probably go with a pretty different approach and manage a separate "RecentList" when updating entries instead for each view. If images are stored on individual pages, you simply maintain a repeater (on some hidden page) holding a page reference to each image. Whenever a new image is uploaded (i.e. use hook on page save), a link is added to that repeater. If it has too many items, the oldest are removed in that step. Since you are using multiple images per article, your repeater has to hold a reference to the article and the basename of the newly added image. On page view you simply load the repeater content (no search at all). To speed up things, you may add more fields to that repeater, like the title of the article, so there is no need for additional database queries. To ensure titles stay in sync, your page save hook needs to update the cached article titles as well.
    1 point
  17. @Robin S Thanks a lot - exactly what i needed! Very nice ? best regards Simon
    1 point
  18. Does the error log tell you more about the 500 error? Just wondering since I basically do the same on the pwflex.team-tofahrn.de search: if($config->ajax && (($query = $input->get->q) != '')) { $query = $sanitizer->selectorValue($query); $search = "text_index~=$query"; $selector = "{$search}, limit=".($Limit+1); $matches = $pages->find($selector); Only difference may be, that my script requires three chars before it sends the query (makes no difference, just tried).
    1 point
  19. We recently finished the relaunch auf camac.de, a client from the software industry, focused on controlling and business integration solutions. Concept, design and implementation by schwarzdesign. The site is focussed on longer content pages with text and image combination, with technical information for potential customers. It also offers multiple options for Call-to-Action elements to maximize conversions. Finally, the site is heavily optimized with caching and minification at every stop to be instantly readable even on slow connections. Features No hard-coded sections in any template: Almost all content types use the same repeater matrix field with several section types. This way, the entire site and all parts of the layout can be moved around and combined in any way imaginable. Custom Call-to-Action options: Two different contact forms, custom external links or a general CTA text. Automatically generated page navigation and human-readable anchors (as seen here) Every page fully loaded and interactive in ~1 second, even on poor mobile connections Automatically generated SEO meta tags, with overwrite fields available on every page Modules used ProFields FormBuilder Tracy Debugger Sitemap Duplicator ALIF - Admin Links In Frontend WireMailSMTP Content and conversions Every visitor is a potential customer - this is why we made sure there are ample opportunities to generate leads. At the end of every page, there are multiple options for the CTA section: A contact form with a customizable message (built with FormBuilder) A download form that allows visitors to download PDFs (e.g. the full article) in exchange for their name and E-Mail address. Other text + image combinations with custom links or buttons. The download form was custom coded, as it allows the editor to upload a file specific to the current page and make it available behind a small form. After successfully submitting the form, an e-mail is sent to the site owner, and the file is directly streamed to the client as a download. Technical insights This is one of the first pages where I used Twig for templating, and it's been a great developing experience. With Twig, you get content escaping and much better seperation between logic and view / display. I also spent some time working out a solid structure for the twig templates, with useful defaults, reusable blocks for page and section template (you can read more about the approach in my recent tutorial on integrating Twig with ProcessWire, part 1 and part 2). I also started using Parcel as a lightweight alternative for Webpack, when all I need is to compile a couple of small scripts (for the navigation, the lightbox, a dismissable cookie notice et c). What's great about parcel is that you get bundling of your own code and external libraries out of the box, as well as ES6+ transpilation and minification for production usage. Still, it required no configuration but a couple of command line options. This way, you get one bundled, minified JavaScript file, the same way we produce a minified CSS file with SCSS, but without the additional overhead of configuring Webpack. Screenshots
    1 point
  20. Maybe here?? https://github.com/processwire/processwire/blob/master/wire/core/Pagefiles.php#L409
    1 point
  21. In case someone else stumbles over similar demands like me, I put my modified AjaxSearch.js here: AjaxSearch.js It allows to use an existing #ajaxSearch element, so you may place the result anywhere in your markup (for example an overlay like I did here: https://pwflex.team-tofahrn.de/). Then I had a problem with excess GET requests which do not cancel server-side processing, so getting the result after typing many characters took seconds. That script uses a different scheduling. Its a direct replacement, so you may try and revert to the original safely. Edit: I've updated the script to send the value URI encoded like this: data: param_name+"="+encodeURIComponent(value), Allows to send queries containing special chars like &
    1 point
  22. I have a (small) new version for you: v1.0.4 adds a $page->listable() hook. If you want to check wether a page should be accessible in list-views, you should use this call to double check if each page can be seen. For detail-views or to check wether a list-item can be linked to a detail-view, you should continue to use $page->viewable().
    1 point
×
×
  • Create New...