Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/31/2017 in all areas

  1. https://www.baumrock.com/portfolio/hr-diamonds.com/ I built this website for my client hrdiamonds.com - a great HR company based in Vienna, Austria. They were totally unhappy with the result of the former agency so it was easier to rebuild the website from scratch than adopting the old CMS (that was actually only 2 years young!)... Design by @lokomotivan built with UiKit Highlights: Frontend-Editing barba.js for smooth page transitions ProCache, of course Favourite client quote of the CEO: Happy to hear your feedback
    6 points
  2. I would use the hook that is called on adding the image to the images field. This is called everytime you add a new image, regardless if you do it via API or via Inputfield. An up to date code example for this hook is here: In this example you can check for a $p->template->name to match as condition to run different code parts, etc. To resize the original image itself, you may want to invoke the imagesizer manually. ---------- Instead of the hook, (for your case above), you only may use the manually invoked ImageSizer for each uploaded file *before* you add it to the image field: // set the max dimensions $targetWidth = 800; $targetHeight = 600; foreach($upload->execute() as $file) { // first get the filename of the *original image* (in case when hooking into file add !!) $filenameOrig = $file; // set options to not upscale, and set quality to 100%, if this image is a source for variations!! $options = array('upscaling' => false, 'quality' => 100, 'sharpening' => 'soft'); // call the imagesizer $imageSizer = new ImageSizer($filenameOrig, $options); $success = $imageSizer->resize($targetWidth, $targetHeight); // resize to max dimensions if($success) $lesson->video_image->add($filenameOrig); } ---------- If you first need to inspect an image, (for conditional processing), you may use the ImageInspector : $imageInspector = new ImageInspector(); foreach($imageFiles as $filename) { $result = $imageInspector->inspect($filename); // to check if we have a valid result, it must be an array if(!is_array($result)) continue; // $result['info'] has all relevant data, like width, height, imageType, mime, orientation, rotate, flip, channels, bits, ... $width = $result['info']['width']; $height = $result['info']['height']; // ... }
    4 points
  3. Another option is the functions API: https://processwire.com/blog/posts/processwire-3.0.39-core-updates/#new-functions-api which lets you do things like: pages("template=basic-page")
    3 points
  4. Hi @pandaman For one of my customers I made some basic experiments to connect the both systems together. Your arguments are valid. I also told him to combine the best of two worlds and let each system do what it's best for. What I can say right now, it is possible, but there might be pitfalls, that I didn't discover yet. One problem was the session management which caused conflicts so you have to modify it. Right now I have the following working solution (PW 3 and Magento 2.1): I installed Magento 2.1 in a "store" directory that lies right beside site and wire directories. I made a magento2-bridge.php in site/templates/ <?php namespace ProcessWire; require $_SERVER['DOCUMENT_ROOT'] . '/store/app/bootstrap.php'; use Magento\Framework\App\Bootstrap; class StoreApp { private static $instance; public static function get_instance() { if ( ! isset(self::$instance) && ! (self::$instance instanceof StoreApp) ) { self::$instance = new StoreApp(); } return self::$instance; } public $helper; public $quote; public $session; public $cart; public $customer; private function __construct() { $bootstrap = Bootstrap::create(BP, $_SERVER); $obj = $bootstrap->getObjectManager(); $state = $obj->get('Magento\Framework\App\State'); $state->setAreaCode('frontend'); $this->customer = $obj->get('Magento\Customer\Model\Session')->getCustomer(); $this->quote = $obj->get('Magento\Checkout\Model\Session')->getQuote(); $this->helper = $obj->get('\Magento\Checkout\Helper\Cart'); $this->session = $obj->get('Magento\Checkout\Model\Session'); $this->cart = $obj->get('\Magento\Checkout\Model\Cart'); } } I had to modify the session management in Magento, so it stores its session variables in ProcessWires directory. I hope I remember this correctly: Change the Cookie Path in Magento @ Stores -> Configuration -> Web -> Defaut Cookie Settings to "/" (without the quotes) Change the save_path for sessions under store/app/etc/env.php 'session' => array ( 'save' => 'files', 'save_path' => $_SERVER['DOCUMENT_ROOT'].'/site/assets/sessions', At some point I changed the sessionAllow parameter of ProcessWire, but I don´t know if this is needed anymore. But for completeness, here is the code I used: $config->sessionAllow = function () { if (strpos($_SERVER['REQUEST_URI'], '/processwire/') === 0) { return true; } return false; }; Then in my site/templates/home.php I have the following code, to get data from Magento (like Customer data, what is in the cart, product information): require_once __DIR__ .'/magento2-bridge.php'; $store = StoreApp::get_instance(); $quote = $store->helper->getQuote(); $quoteitems = $quote->getAllItems(); $customer = $store->customer; bd($customer->getName()); foreach ($quoteitems as $item) { // Code to get contents per product bd($item->getName()); bd($item->getQty()); } If you are wondering what bd() means. It is a debugging output from Tracy Debugger for ProcessWire (recommended install). Why do I share this information here although it was very time-consuming and expensive to figure this out? Because I had great support from the PW community and want to give something back. If you make any progress with this, please try to do the same and share your findings with our lovely community.
    3 points
  5. Just found the error, adding the path did the trick: $imageSizer = new ImageSizer($lesson->video_image->path().$original, $options); Thanks!
    2 points
  6. Also, just an FYI - you can also use Admin Actions to batch activate languages.
    2 points
  7. wire('page'); wire('user'); wire('fields'); wire('pages'); // etc...
    2 points
  8. PW featured in the article "10+ Free Alternative Open Source CMS Tools to Explore". https://designmodo.com/free-cms/
    2 points
  9. This week's version of ProcessWire on the dev branch is 3.0.69 and it includes several minor bug fixes. This week's post focuses in on a new module released today called Login for Facebook, which I think many might find useful, and we've got all the details here: https://processwire.com/blog/posts/pw-login-for-facebook/
    1 point
  10. Had to report back and say that in a multi-site environment, where all the sites are using the same ProcessWire core, it is possible to "share" modules by the method listed above, with no need for symlinks! $config->paths->siteModules = $config->paths->root . 'shared/modules/'; $config->urls->siteModules = $config->urls->root . 'shared/modules/';
    1 point
  11. I am wanting to return all repeater fields, outside of admin, but it seems like you cannot do this without using include=all (even include=hidden doesn't work) but this also includes unpublished pages. Is there a combination to include=all but exclude=unpublished?
    1 point
  12. Take a look at this: https://github.com/adrianbj/ProcessAdminActions/blob/master/actions/PageTableToRepeaterMatrix.action.php It's purpose is to convert a PageTable to RepeaterMatrix, but you should find the code snippet in there that you need.
    1 point
  13. Yes, it should be possible to add a Quick Add feature within the modal. However, how would remove (from within the modal) work (i.e., how would you indicate you want to remove an image/page)?
    1 point
  14. This will happen automatically if the fields for the page don't have a translated version - they will fallback to the default language. Also, just an FYI - you can also use Admin Actions to batch activate languages.
    1 point
  15. New Facebook Login Module by @ryan: http://processwire.com/blog/posts/pw-login-for-facebook/
    1 point
  16. Any update on this ? is this still in motion ?
    1 point
  17. Just a quick note - the "Page Delete" module is obsolete - that functionality has been in the core for quite some time now.
    1 point
  18. You could also just do this. By using "first()" you avoid the need for the foreach loop. $cart->renderPriceAndCurrency($release->children("limit=1, sort=pad_price")->first()->pad_price);
    1 point
  19. Nice one. Just another way to skin the cat... <?php $testimonials = $page->testimonials; $testimonials->shuffle(); $firstTestimonial = $testimonials->shift(); ?> <div class="jumbotron jumbotron-fluid bg-color"> <div class="container"> <h2><?= $firstTestimonial->title; ?></h2> <p><?= $firstTestimonial->testimonialBody; ?> - <i><?= $firstTestimonial->testimonialReviewee; ?></i></p> </div> </div> <div class='container'> <div class='row'> <div class='col-6'> <?php foreach($testimonials as $index => $testimonial): ?> <?php if($index == ceil(count($testimonials) / 2)): ?> </div> <div class='col-6'> <?php endif; ?> <h2 class='py-3'><?= $testimonial->title; ?></h2> <p><?= $testimonial->testimonialBody; ?></p> <p class="font-weight-bold text-muted">- <i><?= $testimonial->testimonialReviewee; ?></i></p> <?php endforeach; ?> </div> </div> </div>
    1 point
  20. Nice! Do you have to change your module version from 1.2.1 to 1.2.2 to appear on ProcessWire Upgrades?
    1 point
  21. @robinc, check out this module code in a Gist by @adrian: https://gist.github.com/adrianbj/2b3b6b40f64a816d397f
    1 point
  22. Not saying it's a good idea because I have no idea how stable it would be, but if you wanted to share all the modules between the sites you could do something like this in each /site/config.php: $config->paths->siteModules = $config->paths->root . 'shared/modules/'; $config->urls->siteModules = $config->urls->root . 'shared/modules/';
    1 point
  23. Visual Page Selector version 003 (released (07/07/2017) Happy to announce that the latest release of Visual Page Selector is now available for Download/Purchase. Documentation is also complete! This is a major update. Visual Page Selector can now be used as a normal but enhanced page field! There are 2 views each for inputfield (page edit) and the page selector modal. These can be combined to suit your workflow as explained in the docs here. As a normal page field, you can opt to view the selected pages as a simple list and add pages to your page field using a ProcessWire Lister modal. This opens so many possibilities, including nuanced differentiation of pages to add to your page field, for example, making use of Lister columns and other page properties. For those that want to use Visual Page Selector as a 'one-page-per-image' solution, you can carry on as normal, with the added benefit of different view combinations In page edit, selectable pages are not loaded directly in the Inputfield allowing you to have hundreds of thousands, nay, unlimited numbers of selectable pages without experiencing any slowdowns (@note: What you see in the screenshot below is not AsmSelect or PageAutocomplete; just a custom list that blends in with the rest of ProcessWire). Please note that there were a few inevitable changes to the field settings. The Lister settings are now separated into individual settings. In addition, there was a typo in the 'vps-delete-page' permission. That should be 'vps-delete-pages'. Due to these, if upgrading from version < 3, please test thoroughly and fix any brokenness before using in production. If you need any help please let us know. Changelog Lister view for an enhanced page field experience. Combine different views as you wish. Faster Inputfield load times in page edit. UX changes. Lister and list view demo
    1 point
  24. Website: https://gatorade.com.do/5v5/ Modules: Form Builder, Lister Pro, Profiler pro, Tracy debugger, Procache (still not installed) It's a simple landing designed to handle registrations to a Gatorade Tournament, but it's kind of cool to see a big brand like Gatorade running Processwire.
    1 point
  25. I have a built in, well versed loathing for contact forms! Okay, did this little contact form which I include via hanna code. This is not my code. On the dev server it worked fine. On the production server, it seems to work (as far as I know) but I am not receiving mail. I have tried setting up spf records. I have changed the destination email address to something different (different domain) but that still doesn't work. I have messed a little bit with wiremail and smtp, but I am not sure what I am doing. At the moment it is back to mail() Not throwing any errors. Anyone got any bright ideas? Here is the basic code: $sent = false; $error = ''; $emailTo = $pages->get("/settings/")->contact_email; // or pull from PW page field // sanitize form values or create empty $form = array( 'fullname' => $sanitizer->text($input->post->fullname), 'email' => $sanitizer->email($input->post->email), 'phone' => $sanitizer->text($input->post->phone), 'comments' => $sanitizer->textarea($input->post->comments), ); // check if the form was submitted if($input->post->submit) { // determine if any fields were ommitted or didn't validate foreach($form as $key => $value) { if(empty($value)) $error = "<p class='error'>Please check that you have completed all fields.</p>"; } if($input->post->my_message) { $error = "Sorry, there has been a problem"; } // if no errors, email the form results if(!$error) { $msg = "Full name: $form[fullname]\n" . "Email: $form[email]\n" . "Phone: $form[phone]\n" . "Comments: $form[comments]"; mail($emailTo, "Contact Form", $msg, "From: $form[email]"); // populate body with success message, or pull it from another PW field echo "<h2>Thank you, your message has been sent.</h2>"; $sent = true; } } if(!$sent) { // sanitize values for placement in markup foreach($form as $key => $value) { $form[$key] = htmlentities($value, ENT_QUOTES, "UTF-8"); } // append form to body copy echo <<< _OUT $error <form action="./" method="post" class="shortform"> <div class="row"> <div class="columns"> All Fields Required </div> <div class="columns"> <label for="fullname">Your Name <input placeholder="Your Name" type="text" id="fullname" name="fullname" value="$form[fullname]" /> </label> </div> </div> <div class="row"> <div class="columns"> <label for="email">Your Email <input placeholder="Email" type="email" name="email" id="email" value="$form[email]" /> </label> </div> </div> <div class="row"> <div class="columns"> <label for="phone">Your Phone <input placeholder="Phone" type="text" name="phone" id="phone" value="$form[phone]" /> </label> </div> </div> <div class="row"> <div class="columns"> <label for="comments">Comments <textarea placeholder="Comments" id="comments" name="comments">$form[comments]</textarea> </label> </div> </div> <div class="row"> <div class="columns"> <input class="button small large-12" type="submit" name="submit" value="Submit" /> </div> </div> </form> _OUT; }
    1 point
×
×
  • Create New...