Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/17/2018 in all areas

  1. I don't know if popular is the right word. I have never came accross another person who knew ProcessWire here in The Netherlands. Ofcourse people use it and I got a feeling there is growth. Most people who have used ProcessWire definately keep using it or at least they want to use it. That is on itself a great accomplishment only achieveable by a few people. Same for the good community and such loyal users while the development is solid with great pro modules. I guess it is really hard to break through a next level. Just keep promoting it ?.
    4 points
  2. We used http://barbajs.org/ for the transitions. This was for me the best tool to create good transitions. It also includes a preloading/prefetch option: http://barbajs.org/prefetch.html. When the user hovers over a link, it preloads the page. The time difference between hover and click is about 250ms to 750ms in our tests. This is in the most cases enough to load the full .html document. Here is an interesting website to test it yourself: http://instantclick.io/click-test This is how a transition works: The user hovers over a link The browser prefetches the site (Including Base64 placeholder images) The user clicks the link (The time difference between hover and click is long enough to load the document) The actual page transition out The loading screen transition in (In most cases it will skip this step because the page is already loaded) The new page transition in We can change the direction of the transition with data-attributes: <a href="/arbeit/" class="button-enter introduction-button" data-transition-direction="left">Arbeit</a> When you have other questions please feel free to ask ?
    3 points
  3. We recently finished a relaunch of our agency website: https://www.meuter.de/ Features: Minimalistic and modern design Page transitions and preloading for a really fast browsing expierence Custom content builder for blog posts, references and subpages Content is king: Many case studies and blog posts Under the hood: Webpack with ES6 and SCSS LQIP with Base64 Images Lazy loading with lazysizes Automatic generation of scrset images, Base64 placeholder images and background positions Page transitions with barba.js Preload pages when user hover over link Interactive components which reacts on scroll events. Built with ScrollMagic Handwritten template Modules used: ProFields Markup Sitemap XML Video embed for YouTube/Vimeo Our Content Builder for a reference: Clean page structure: The code for the image generator: <?php // ------------------------------ // Image modifications // ------------------------------ /** * Responsive Image Options */ class imageModifier { // Responsive Sizes from lowest to highest private $responsiveSizes = array(320,640,768,1024,1366,1600,1920,2560); private $base64ImageWidth = 20; private $imageOptions = array( 'upscaling' => true ); // Return a string with the srcset information public function getSrcSet($image){ // Create an emptry output string $srcSetOutputString = ''; // Create each image for each size foreach ($this->responsiveSizes as $responsiveSizeId => $responsiveSizeWidth) { // Check if the image is bigger then the final size if($image->width >= $responsiveSizeWidth){ // Create the image and put the url into the output string $srcSetOutputString .= $image->width($responsiveSizeWidth, $this->imageOptions)->url; // Put the width in the output string $srcSetOutputString .= ' ' . $responsiveSizeWidth . 'w' . ','; } } //When the original image is smaller then the highest quality if($image->width < $this->responsiveSizes[count($this->responsiveSizes) - 1]){ // Create the image and put the url into the output string $srcSetOutputString .= $image->width($image->width)->url; // Put the width in the output string $srcSetOutputString .= ' ' . $image->width . 'w' . ','; } // Remove last commata $srcSetOutputString = rtrim($srcSetOutputString, ','); // Return the srcSet information return $srcSetOutputString; } //Returns the lowest quality image public function getLowestQuality($image){ return $image->width($this->responsiveSizes[0]); } //Returns the highest quality image public function getHighestQuality($image){ // if image is bigger or same than max quality if($image->width >= $this->responsiveSizes[count($this->responsiveSizes) - 1]){ return $image->width($this->responsiveSizes[count($this->responsiveSizes) - 1]); } // When image is smaller then the highest quality else { return $image; } } // Returns the base64 data string public function getBase64($image){ // Get the image path $imagePath = $image->width($this->base64ImageWidth)->filename; // Get the image extension $imageType = pathinfo($imagePath, PATHINFO_EXTENSION); // Get the data of the image $imageData = file_get_contents($imagePath); // Create the base64 Code $base64Code = 'data:image/' . $imageType . ';base64,' . base64_encode($imageData); // Return the code return $base64Code; } // Returns the position point public function getPosition($image){ // Get distance from top $distanceTop = '' . intval($image->focus()['top']); // Get distance from left $distanceLeft = '' . intval($image->focus()['left']); // Return the position with percent return $distanceLeft . '% ' . $distanceTop . '%'; } } Thanks for the community and Processwire. It is a joy to use ?
    2 points
  4. The error is caused by the code you entered in the field settings. The eval line above just executes the configured code. So if you show us that code, it might be possible to pinpoint the exact issue.
    2 points
  5. --- Please use RockFinder3 ---
    1 point
  6. So I was planning on doing a full write up a while back to compare the different CMS systems: Craft, Processwire, Silverstripe Since I'm here I will just focus on my experiences with ProcessWire. With some experience with developing websites in Silverstripe I figured it would be good for me to have a look at some other options which brought me here. I do have some features which I really want to have with websites which I deliver to my customers: Must haves: Version management -> if a client screws something up I don't want to waste too much time to get things back in working condition. Easy editing of pages for customers. Extensibility with extra content fields in the CMS. Nice to haves: Inline editing. Easy Multilanguage setup. Easy upgrades. First Impressions: The good: Processwire looks pretty good from a power user point of view. I love the fact that you can just use PHP in templates and also the obvious active development is a big plus and it seems to be very extensible. The bad: No support for IIS out of the box. I did find a web.config on the forum but needed to sign up to the forum to download this. Signing up to the forum lists facebook as a sign in option -> doesn't actually work. The first impressions on the look and feel of the admin. Implementing Actually porting a site template over to processwire with the functionality I needed to add: This process went pretty smoothly I loved the pw-append way of working with templates, templates felt really easy to port and set up. Creating menu's etc. was easy. I loved the way that there are multiple ways of doing things which are available with the templates which can be installed. I also loved how easy it was setting up inline editing and adding an edit link to a page. I think my main problems with settings things up where the way processwire handles images. The problems I had with version control plugin + images. Usability testing After having set up the basics I had 2 lovely lady friends do some usability testing by letting them perform some small tasks on the website. Edit some pages -> add an image Swap the position of 2 pages in the menu. Both smart ladies 1 of them had been actively maintaining a magento shop. And their conclusion was unanimous, they both heavily preferred the Silverstripe backend. For me this meant that I continued to work on the Silverstripe version of the website. I didn't continue to complete all the functionality in the Processwire version of the website. Conclusion For me the conclusion of this experiment was that although I loved building the basic website with Processwire the admin experience just doesn't seem user friendly enough to justify the switch.
    1 point
  7. I'm having a strange issue here where my selector is case sensitive on a default install with no modification MySQL. The selector is as follows: $vars = explode("?", $_SERVER[REQUEST_URI])[1]; $selector = implode(", ", explode("&", $vars)); echo $selector; $variation = $page->wc_variations->get("wc_variation_value='$selector'"); This doesn't work `$selector` outputs `size=14, colour=blue` If I was to change the value given to `Size=14, Colour=Blue` it then finds the repeater item. Anyone else come across this issue before? EDIT: Seems like there is an inconsistency between database searches and in memory searches. I've just done an extra: foreach($page->wc_variations as $variation) $variation->wc_variation_value = strtolower($variation->wc_variation_value); Before doing the selector. Not great, but it works.
    1 point
  8. Since the only line with property access is $element = $pages->find("template=clef, langue=$langue, limit=1, sort=-id")->first()->title; it seems that your selector returns no results, so the call to first() returns null and accessing the title leads to the error. Your contributor account may not have permissions on the template or the pages in question may be hidden or unpublished. Depending on the exact scenario, an additional selector is probably necessary (see the link for details).
    1 point
  9. In such cases, I always lcfirst() my properties and also make sure to remove any spaces. $key = lcfirst($sanitizer->fieldName($key));// "Size" to "size" OR "some key" to "some_key"
    1 point
  10. There is. I've found that *= in in-memory searches works irrespective of case (IIRC).
    1 point
  11. Hey @pwired and @louisstephens, I was not referring to collecting anonyous data from other installations. Generally I get where the idea is coming from, but I don't think it is going to work from a practical point of view ? I was referring to the "salesand subscriptions from the pro modules". Have you looked at the nomadlist link what kind of data they are showing? I guess that is quite possible - if you want to share it.
    1 point
  12. Latest Chrome/Safari/Firefox on macOS 10.14 show all the same problem. The weird thing is it creates the correct amount of pages in the PDF, they’re just blank. Calling `$mpdf->Output($filename, \Mpdf\Output\Destination::DOWNLOAD);` directly results in the same error.
    1 point
  13. Thanks to all who got in touch. I have found a developer to take this one on now.
    1 point
  14. Something I've done that is quite useful is setup a Less parsing library like this one that accepts variables and then I pass the variables on to the rendering pipeline, this keeps my styles files clean from php code: Pardon the dirty code: <?php $variables = array( 'main-color' => $home->main_color , 'body-background' => $home->color_main_background, 'icon-colors' => $home->color_icons, 'menu-icon-color' => $home->color_menu, 'footer-gradient' => $home->color_footer_gradient, 'go-top-gradient' => $home->color_got_top_gradient, 'slide-background-color'=> $home->color_slides_background, 'slide-hover-background-color'=> $home->color_slides_hover_background, 'h2-titles-color'=> $home->color_h2, 'headings-font'=> $home->headings_font, 'footer-background' => $home->color_footer_background ); //Set up main file path and directory of imports. $less_files = array( $mainCssFile => $config->paths->templates . 'css/' ); $options = array( 'cache_dir' => $config->paths->assets . 'cache/less/', 'output' => $config->paths->templates. 'css/build.css', 'relativeUrls' => false, "strictMath" => "on"); try{ $css_file_name = Less_Cache::Get( $less_files, $options, $variables); }catch(Exception $e){ $log->save("less", $e); } ?>
    1 point
  15. Hi @mke Thanks for the clarification and example. That fits into the planned separate pro frontend module. As stated, those who want to build custom frontend will have the full API at their disposal. Something like this (pseudo code, although some API is ready) // assuming user is logged in, they are redirected to My Account area $out = "<span>$user->name</span>"; // your Orders Table [orders API in the works] $orders = $pages->find("template=orders,order.customer_id=$user->id,limit=10"); foreach($orders as $o) { $order = $o->order; /* Date: $order->date; Status: $order->status; etc... */ } // Addresses [customer API 95% done] $customer = $user->customer; /* First Name: $customer->firstName; Last Name: $customer->lastName; Email: $user->email; Address: $customer->address; City: $customer->city; Postal/Zip Code: $customer->code; Region: $customer->region; Country: $customer->country; Phone: $customer->phone; // etc...including if customer is tax exemp and whethey they accept marketing. // Any custom properties added are also available, e.g. $customer->company, etc. */
    1 point
  16. @joshuag Are there any updates on this awesome module already? Can't wait to try it.
    1 point
  17. ProcessWire API Visual Studio Code Snippets Here is a Gist of all (?) ProcessWire public API snippets for VSC. This is generated from the ProcessWire Cheatsheet. Some stuff needed manual cleanup. I also removed the stuff from the selectors section. I could have missed something, please let me know. Please note this is a complete, well-formed JSON file. If you need to copy to your existing VSC snippets file (most likely your php.json), remember to remove the top and bottom outermost curly braces. One great thing about VSC is that it doesn't care much about typos; fuzzy search will find what you meant to type. E.g., 'cnf' will match 'config'. Maybe the JSON file is too long, I don't know, but sometimes the snippets' descriptions don't show up. The snippets are for use in a template file (i.e., no auto $this->), but you can still use it in a module and/or modify it to suit such needs. Hope you find it useful :-). Demo
    1 point
  18. Yes, add fields for all the settings you need (e.g. with @Soma's ColorPicker module). Then add the styles inside style.php like you quoted above. body { background:<?=$page->bgcolor-field ?> url(<?=$page->bgimage-field ?>) no-repeat; } /* ...any other styles, with or without PHP code */ Then, in your regular template file, include the CSS settings page. <link rel="stylesheet" href="<?= $pages->get('/your/css/page/')->url ?>"> Basically, you've now created a separate PHP file for all the CSS so you don't have parts in a regular stylesheet and others in your template file. Once everything works, you can go into the style template's settings and switch on caching. Enter a cache time (like 86400 to regenerate the CSS only once a day) and you have performance close to a flat file stylesheet.
    1 point
  19. Just a quick note: remove the hints in the function, otherwise it won't work: function getFieldsetOf($context, $fieldsetName, $collectValues = false, $fieldsetCloseIdentifier = '_END'); // this will work function getFieldsetOf($context, String $fieldsetName, bool $collectValues = false, $fieldsetCloseIdentifier = '_END'); // this won't at least not with the latest PW dev on PHP 7.0.9 example function call: $fieldSet_import = getFieldsetOf($templates->get('project'), 'import_only', false, $fieldsetCloseIdentifier = '_END');
    1 point
  20. <?php /** * getFieldsetOf * * for ProcessWire * * gets fields inside a fieldset of pages or templates * choose to retrieve values * * @param Template|Page $context the page or template * @param String $fieldsetName name of the fieldset * @param bool|boolean $collectValues want to collect values of the pages fieldset? * @param string $fieldsetCloseIdentifier default: '_END' * @return FieldsArray|WireData returns FieldsArray or if data wanted, WireData */ function getFieldsetOf($context, String $fieldsetName, $collectValues = false, $fieldsetCloseIdentifier = '_END') { if ($collectValues === true && $context instanceof Page) { $collectedItems = new WireData(); } else if($context instanceof Template) { $collectValues = false; $collectedItems = new FieldsArray(); } else { throw new WireException("getPageFieldset: first argument must be of type Page or Template", 1); } if (!$context->fieldgroup->get($fieldsetName . $fieldsetCloseIdentifier)) return NULL; $collecting = false; foreach ($context->fieldgroup as $field) { if ($field->name == $fieldsetName) { $collecting = true; continue; } if ($field->name == $fieldsetName . $fieldsetCloseIdentifier) { break; } if ($collecting) { if ($collectValues) { $collectedItems->set($field->name, $context->get($field->name)); } else { $collectedItems->add($field); } } } return $collectedItems; } Some extension of the above code - works with templates and pages. If thrown at pages you may choose to retrieve the values inside the fieldset as a WireData object. edit: @dragan (below) thanks for the hint! Just removed it.
    1 point
  21. So I have created a small module to do this. In addition to preventing users from logging in, I also want to log out everyone, but cannot get this to work - does anyone have an idea why it does not log users out with the code below? Preventing login works fine. Am I hooking wrong? Thanks! <?php /** * */ class SessionLoginDisable extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Session Login Disable', 'version' => 001, 'summary' => 'Provides option to disable login for all users except superusers.', 'author' => 'Lars Bergemann', 'autoload' => TRUE, 'singular' => TRUE ); } public function init() { $this->addHookBefore('Session::allowLogin', $this, 'allowLogin'); $this->addHookAfter('Session::isValidSession', $this, 'isValidSession'); //no effect currently $this->addHookBefore('ProcessLogin::execute', $this, 'disableLoginNotice'); } public function allowLogin($event) { $name = $event->arguments[0]; $user = strlen($name) ? $this->wire('users')->get("name=$name") : null; if(count($this->disable) > 0 && $user && $user->id && !$user->isSuperuser()) { $event->replace = true; return false; } return null; } public function isValidSession($event) { if ($event->return) { $userID = $event->arguments[0]; $user = wire('users')->get($userID); if (count($this->disable) > 0 && $user && $user->id && !$user->isSuperuser()) { $event->return = false; } } } public function disableLoginNotice($event) { $this->error("Login currently disabled."); return null; } }
    1 point
×
×
  • Create New...