Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/09/2019 in all areas

  1. Saturday morning I wrote in the the latest weekly issue this: And here's the view from my front door just now, Tuesday morning: I'm not particularly superstitious, but kinda feels like I dropped the ball on this one. To my defence, on Saturday there was literally zero snow here, and the whole day was sunny and warm and all. Proper shorts and T-shirt weather. I guess the lesson here is that it's always too early to say that the winter is over. Have a great day, folks!
    10 points
  2. What could the controller look like then? ?
    4 points
  3. I tried logging out multiple times during the process, but no go. In the end I wiped the installation and started from scratch, and this time it worked properly. I'm not sure what went wrong on the first time. Don't get me wrong though, PW is hands down my favorite CMS. After 10+ years of suffering with Joomla and occasional WP and Drupal installations, it's very welcome change indeed. @wbmnfktr Setlocale is a big mystery for me. When you read the forums, you find a lot of different information. "Set it in config, no you must set it in _init, no this third place is the one that worked for me". Even after setting it per language in the backend, Processwire will often relentlessly keep popping up the notification that you must set setlocale correctly. I've finished now perhaps 10'ish PW sites, and sometimes it works and sometimes it doesn't. @horst Cheers, I'll keep this in mind.
    3 points
  4. Sounds like a classical use case for server redirects. For example, in Apache, assuming your old subtree lived under "example.com/canines/..." and you want to move it to "example.com/dogs/...", here's a simple redirect rule that will do that, while preserving the rest of the path: RedirectMatch "^/canines/(.*)" "/dogs/$1" Example shamelessly taken from the Apache manual. Would be trivial in nginx as well. You can do the same thing in your PHP logic, but it will be slightly slower. By using the Apache redirect, the server needn't even bother ProcessWire with the request.
    2 points
  5. If you need the Croppable Image Field, you may install the CroppableImage3. But with the newer PW versions there is the feature focuspoint with or without zoom. If you not already know it, it is well worth a test.
    2 points
  6. Great points @wbmnfktr! Thanks for pointing me to ploi.io @Mikie - looks like a good alternative to runcloud ? I'm using my own VPS's at reliable hosting companies in AUT/DE as for the reasons @wbmnfktr mentioned. Personally I don't do any installations on 3rd party hosting providers any more. For me it was always a pain at some point. For example one hoster just didn't have SSH access and there was no option to transfer the whole site at once. Transferring the whole site via FTP would have taken hours... that's really not worth the saving of 5€/month compared to having all on my VPSs and full control over everything and being efficient and fast. I've never had problems with my clients paying 5-10€/month for hosting on my server, when I tell them that setting up the website on their servers costs extra money and is a lot less efficient and more expensive in everyday operation. And that's not a lie! But it depends on your business... If you only do simple websites with no extra needs and maybe even no updates for several years, then it might be easier and better to choose a standard hosting provider that does everything for you (including invoicing, which can be tedious). 5-10€/month is for sure not worth doing everything on your own if you don't need any advanced features (like ssh, git support, etc).
    2 points
  7. So without the croppable image module variations are generated on demand. If your clients upload quite big images and you want to generate a maybe even larger than needed set of variations this is going to take some time and even more memory on the initial request. But that's a whole different problem than "how can I not create the default variation for an image" with completely different ways to get to a solution. I still don't get why you insist on filtering down all available variations wherever they might come from. I expect you have a list of sizes for your srcset defined somewhere, so just use those. You can still check the images dimensions to filter out the sizes you defined greater than the image's dimensions. Something like the following. <?php function responsive_image($image, $widths = null) { $widths = $widths || [200, 400, 800, 1200, 1600, 2000]; $default = 400; $smaller_widths = array_filter($widths, function ($width) use ($image) { return $width <= $image->width; }); $srcset = array_map(function($width) use ($image) { return "{$image->width($width)->url} {$width}w"; }, $smaller_widths); $srcset = implode(", ", $srcset); return <<<HTML <img src="{$image->width($default)->url}" alt="{$image->description}" sizes="(min-width: 640px) 60vw, 100vw" srcset="{$srcset}"> HTML; }
    2 points
  8. No... it always depends on the project and website. But there are a few things I don't want to miss. Those are: SSL/https with Let's encrypt SSD webspace because it's faster Admin panels like cPanel are nice but not necessary SFTP/SSH is a benefit Cron of any flavour is highly appreciated GDPR compliance in terms of data-processing-agreements (or however they are called) A good reputation (4.5+ ratings) A good website with all relevant details (Imprint, Privacy, GDPR) A good website that's not powered by a WordPress theme More than 5 years in business Servers in my home country Free or local support hotlines + the things mentioned above Yes... It's more about the company than the webhosting itself but these things are as important as everything else. Maybe even more. Nope... never did anything like that with a ProcessWire project. FileZilla is S/FTP so about 99% of all webhosting companies should fit here. ? I prefer Site Profile Exporter as I create a full copy of everything with only a few clicks. I know others here that prefer Duplicator. So... try everything and decide which way to go. Regarding sync-scripts of any kind... not mine at all. As said before... it really depends on your needs. I never used webp support in a live project so far and therefore never had the need of special modules. But yes... put it on your checklist and later on ask hosting companies if they support those features.
    2 points
  9. @happywire check out services like https://runcloud.io or https://ploi.io for managing multiple vps. For deploying code https://github.com/git-ftp/git-ftp works really well for a simple workflow, and syncing files / database up or down can be done in one command with a simple bash script if you have ssh access, there are plenty of references if you search GitHub gists.
    2 points
  10. Like in recent weeks past, the primary focus this week in core development was working through the queue of older issue reports. Relative to 3.0.128, ProcessWire 3.0.129 contains 17 commits over 1 week, most of which are focused on resolving and closing out older issue reports. However, there have also been a few very useful additions too, and I’m going to cover them in a blog post next week. In terms of our issues repository, we are now down to 65 open issues and 777 closed (the closed number is a total over the life of this repo). If we subtract issues that are tagged as being fixed, not a bug or ready to close, we’re around 55 open issue reports (give or take a couple depending on when we check). Which is to say, there’s a lot of great progress here. And many of the remaining issues are minor things that might only affect one person, though still important nonetheless. Thanks to everyone that’s helping figure things out (such as Toutouwai, Matjazpotocnik, Netcarver and others), your help is greatly appreciated. Just now I also released a new version of ProMailer (v7) which accommodates many of the recent feature requests and fixes a few minor issues as well. There has been a lot of enthusiasm for ProMailer, pleasantly more than expected—thanks for your interest and support. Here’s the changelog for the latest version (v7) below. There is also more good stuff in the works for v8 as well. Changed subscribers list interface to use tabs. Added ability to remove all subscribers from a list. Added ability to remove filtered subscribers from a list (matching find query). Added ability to import subscribers from another list (creating a merged list). Added support for single, multi-select and checkbox custom fields. Added support for PW 3.0.129+ core WireMail blacklist (more details in next week’s blog post). Added several new options for custom fields (see new custom fields reference). Added documentation for conditional placeholders. Split the rather large ProcessProMailer.module into separate files/classes. Fix some display issues in AdminThemeDefault and AdminThemeReno. Various minor bug fixes and other minor tweaks, additions and improvements. Thanks for reading this quick update and hope that you have a great weekend.
    1 point
  11. Is there any good way to manage PW dependencies - mainly modules - with composer or else? I know that there are some PW modules available for composer, but not all. Does anyone have an idea to get other 3th party modules manageable with composer? In our team of 3 dev's it would help us a lot to handle module updates and dev setup. I was playing around with a idea to build a "ppm - processwire package manager" on my own if I find nothing good.
    1 point
  12. @Robin S Holy macaroni. That was it. I thought I had tried everything. Where...where do I paypal you some beer money? Seriously. DM me if that's possible. I owe you big time.
    1 point
  13. Okay, now I finally understood what is MVC about ?
    1 point
  14. I'm only interested in models with a great "view": https://www.google.com/search?q=models&tbm=isch Don't even try to control them, youl'll fail!
    1 point
  15. The idea of easy inclusion of any custom Javascript sounds good. The module I made and use is very slim and very stable. I use it extensively, especially with hooks and the full PW API and PHP. The only Javascript I have included currently is iframe resizer.
    1 point
  16. Thanks! Finally figure out how to do it ?
    1 point
  17. @Hurme @wbmnfktr Regarding setlocale, pls read my post The message @Hurme described, is most likely this one https://github.com/processwire/processwire-issues/issues/732 correct?
    1 point
  18. Typically you want to click on the ajax called file that is uploading - Then on the response tab - that should show you any errors that are corrupting the uploading. Also, just an FYI that your version of Tracy is a year old ?
    1 point
  19. The module can be found at https://github.com/MetaTunes/AdminInModal Use at your own risk! The hook is specific to my app, but I hope the following gives the general idea: wire()->addHookAfter('User::hasPagePermission', function(HookEvent $event) { // Get the object the event occurred on, if needed $user = $event->object; // An 'after' hook can retrieve and/or modify the return value $return = $event->return; // Get values of arguments sent to hook (if needed) $permission = $event->arguments(0); $p = $event->arguments(1); /* Your code here, perhaps modifying the return value */ // Is it a page we need to customise access for? $templates = ['Membership', 'Member', 'Profile', 'Subscription', 'Payment', 'MemberShop', 'Booking', 'NewsItem']; $permissions = ['page-edit', 'page-add']; if ($p and in_array($p->template, $templates) and $permission and in_array($permission, $permissions)) { // Get the member-user $currentUser = $this->users->getCurrentUser(); if ($currentUser and $currentUser->isLoggedin()) { if ($currentUser->hasRole('member')) { $email = $currentUser->email; $memberPage = $this->pages->get("has_parent=/memberships/, template=Member, email=$email"); if ($currentUser->memberOnly) $return = false; // Member-only users can only access pages as defined below if ($memberPage->id) { $membershipPage = $memberPage->parent; //... and a lot more like that ($profilePage etc.) ... $editablePages = new PageArray(); $addablePages = new PageArray(); $editablePages = $editablePages->add($membershipPage)->add($profilePage)->add($siblings)->add($currentSub)->add($shops)->add($subsPaymentPages)->add($draftNewsPages)->add($bookingPages); $addablePages = $addablePages->add($membershipPage)->add($memberPage); // pages where creation of children is allowed if ($editablePages->has($p) and $permission == 'page-edit') $return = true; if ($addablePages->has($p) and $permission == 'page-add') $return = true; } } } } // Populate back return value, if you have modified it $event->return = $return; });
    1 point
  20. I only used the module FieldtypeRuntimeMarkup for now and it works, but has one big disadvantage (which maybe not applicable to all users): You can not use the runtime markup fields in a ListerPro to sort because PW is looking for a database table and throws an error.
    1 point
  21. That $floors is just a variable set from the php file which actually includes the skyscraper-list-item.php. You'll have to modify the php file actually including this one (may be included multiple times). You may start looking in function renderSkyscraperListItem located in _func.php: // send to our view file in includes/skyscraper-list-item.php $out = files()->render('./includes/skyscraper-list-item.php', array( 'skyscraper' => $skyscraper, 'url' => $skyscraper->url, 'img' => $img, 'title' => $skyscraper->title, 'city' => $skyscraper->parent->get("title"), 'height' => $skyscraper->get('height|unknown'), 'floors' => $skyscraper->get('floors|unknown'), 'year' => $skyscraper->get('year|unknown'), 'summary' => summarizeText($skyscraper->get('body'), 500) )); ...and, of course, welcome to the forum!
    1 point
  22. Hey @dragan and @flydev thanks for the responses. @flydev you solved it. My sanitised variable wasn't beautified and had multiple dashes to replace dirty characters, so the get was failing. Thanks so much for the help!
    1 point
  23. Even if the compressed size does not differ much, don't forget that images need to be decompressed on client side in order to get displayed. Devices with ram limitations may fail to hold too much image data in memory and either fails to display the image completely or need to decompress whenever the viewport requires to render the image. Edit: The larger screenshot has a resolution of 1000x679 pixels, if images are decompressed into 32 Bits (RGBA), the footprint on client side is about 20MBytes, the smaller one with 628x426 only occupies 8MBytes. I wouldn't bother about client resizing for few of such images per page as well, but if your pages may contain more pictures (like a thumbnail gallery), I'd really consider to deliver smaller versions.
    1 point
  24. and with AdminOnSteroids installed in the backend, you can switch the admin language on the fly and independent from your selected language in the user profile:
    1 point
  25. @wuvidda This is an english speaking forum. Please include at least an introductary paragraph in english language into your post.
    1 point
  26. I'm really wondering when this book was written though. I've not had major problems with differences in browser implementations in years. The bigger problem is support of APIs, which might not be present in all browsers, but those are imho better solved by adding polyfills, which can be removed once browser support numbers are high enough without changes needed to be made to the actual javascript. I mean jQuery is still a valid choice today if you need it. I just feel the number of times you really need it is diminishing. Browser APIs getting better is one reason for that and the move away from imperative DOM manipulation to more abstracted view libraries is another. jQuery's move to slimming down it's core size might also have been just a notch to late, when everybody was already migrating of of jQuery. Edit: If you're using jQuery in your application logic, you can't help but know how you directly manipulate the DOM and need to account for all the details needed to change it. That means your application logic will always need to be update if you want to alter behaviour down to the updates to the DOM needed (e.g. change detection to keep changes minimal for performance reasons). That’s a recipe for disaster. You should absolutely be using a javascript view library to abstract away what parts of the DOM need to be updated. Libraries like Vue, React, Svelte, … abtract away the low level DOM manipulations behind facades, which allow you to focus on building your application in a rendering-agnostic way. This goes as far as using e.g. reactnative outside the browser. Arguments like that can be made for any layer of abstraction out there. It's a matter of which level of abstraction makes the most sense for a certain project to be written in.
    1 point
  27. Most of my clients already have some sort of webhosting and only in very few cases it needs an update in terms of more features like SSL and similar things. If they don't have webhosting I recommend a middle-sized shared hosting from trusted providers. An all-in-one package works in almost every situation. Domain + Hosting + E-Mail management = ~15 EUR/month that's it and all they need. In the past I have had root servers and VPS to host client projects. It was a nice option, additional money, and a good way to keep clients close. But as regulations and laws changed over the past years I decided to stop offering hosting services. Hosting isn't that expensive anymore and you find really good options out there. Hosting providers are there for a reason. They take the hassle away from me. If your client already has a website, take a look at their web analytics to see how much traffic there is. You can then decide which way to go and what package might be a good deal if there are performance issues. As far as I can say... a good ProcessWire site doesn't need that much of a high performance hosting. Unless you can't use ProCache even a super cheap $3 shared hosting might work well enough. ProcessWire sites with ProCache, almost no real-time-database interactions, and only a few forms have a nice small footprint.
    1 point
  28. Also worth noting that there is a 7 page book related to the rejection craze of jQuery and other libraries: https://www.oreilly.com/programming/free/native-javascript-apis.csp Quotes: "If you’re using native APIs in your application logic, you can’t help but know what browser is being used because you need to account for browser differences. That means your application logic will always need to be updated as new browsers and new browser versions are released. That’s a recipe for disaster. ... You should absolutely be using a JavaScript library to abstract away browser differences for you. ... Libraries like jQuery, YUI, and Dojo abstract away browser differences behind facades, which allow you to focus on building your application logic in a browser-agnostic way. ... So, keep using your favorite JavaScript library. Don’t be tempted by the draw of native APIs simply because you can avoid downloading an external library. Using native APIs comes with a high cost of maintainability down the road." People write spaghetti code because they do not know JavaScript well enough and/or do not use appropriate design patterns, which is not jQuery's or other libraries' fault. One can just as well produce unmaintainable code by using any framework out there. Here is the case of UIkit 3 which relies on its own 132k JS library which is only partially documented: https://github.com/uikit/uikit-site/blob/feature/js-utils/docs/pages/javascript-utilities.md They say: "...allow you to write simplified Vanilla JavaScript and replace the most common functions of jQuery" So they got rid of jQuery by partially re-implementing its features. Good to know... Now if I add jQuery I have overlapping feature sets and the visitor of the site has to download more assets ? Is it an improvement? At the same time the current full version of jQuery (3.3.1) is 87k and one can use versions leaving out features not needed (say AJAX or effects if not used on a site), so it can further be trimmed if the projects allows. Introducing a mature and maintained JS library called JsViews: Currently, I have started to build upon a library which can either be used along with jQuery or without it: https://www.jsviews.com/ It is from one of the jQuery authors. Worth checking out the examples, eg.: https://www.jsviews.com/#samples/computed/team-manager JsViews can be used without precompiled JS templating – so it is easy to get started – and it is still very performant that way. One can also use a builder to precompile the templates if needed (think of the needs of overly complex JS apps and NOT websites). By using JsViews one can rely on declarative programming and build upon design patterns built in. By adding jQuery to it, code becomes shorter, easier to read and maintain.
    1 point
  29. This profile can be used as a simple business card or it can be used as a starting profile. Live Example Can download from this link: https://github.com/rafaoski/site-minimal Basic Info Most of the profile settings and translates are in the _init.php file. Functions can be found in the _func.php file. The entire view is rendered in the _main.php file that uses markup regions. You can easily add hooks using the ready.php file. Options page added with the new “Unique” status, which you can use in this simple way like: pages('options')->site_name pages->get('options')->site_name Screenshots:
    1 point
  30. @itsberni I just ran into this on my development server (using PHP7.2) The clues to a fix were found here. NB, this module doesn't need ImageMagick/Ghostscript to have write permissions for PDFs to generate the thumbnails, read permission worked just fine for me. <policy domain="coder" rights="read" pattern="PDF" />
    1 point
  31. Here is my setup: My Dockerfile: # # PHP Dependencies # FROM composer:1.7 as vendor COPY web/ /app RUN composer install \ --ignore-platform-reqs \ --no-interaction \ --no-plugins \ --no-scripts \ --prefer-dist # # Frontend # FROM node:latest as frontend COPY --from=vendor /app /app WORKDIR /app/site/templates RUN npm install --global gulp-cli && \ npm --prefix /app/site/templates install gulp /app/site/templates && \ npm --prefix /app/site/templates install /app/site/templates && \ gulp build # # Application # FROM php:7.2.7-fpm-alpine COPY --from=frontend /app /var/www/html WORKDIR /var/www RUN apk add --update $PHPIZE_DEPS \ freetype-dev \ libjpeg-turbo-dev \ libpng-dev \ && docker-php-ext-install iconv pdo pdo_mysql mysqli opcache zip \ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install gd \ && rm -rf /var/cache/apk/* \ && chown -R www-data:www-data . # set recommended PHP.ini settings # see https://secure.php.net/manual/en/opcache.installation.php RUN { \ echo 'opcache.memory_consumption=128'; \ echo 'opcache.interned_strings_buffer=8'; \ echo 'opcache.max_accelerated_files=4000'; \ echo 'opcache.revalidate_freq=2'; \ echo 'opcache.fast_shutdown=1'; \ echo 'opcache.enable_cli=1'; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini \ My dev_docker-compose.yml: version: '3' services: web: image: nginx:alpine volumes: - ./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf:delegated - ./etc/ssl:/etc/ssl:delegated - ./web:/var/www/html:delegated - ./etc/nginx/default.template.conf:/etc/nginx/conf.d/default.template:delegated - ./logs/nginx/:/var/log/nginx:cached ports: - "8000:80" - "3000:443" environment: - NGINX_HOST=${NGINX_HOST} command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" restart: always depends_on: - php - mysqldb php: build: ./ image: app:latest restart: always environment: MYSQL_HOST: ${MARIADB_HOST} MYSQL_PORT: 3306 MYSQL_DATABASE: ${MARIADB_DATABASE} MYSQL_USER: ${MARIADB_USER} MYSQL_PASSWORD: ${MARIADB_PASSWORD} volumes: - ./etc/php/php.ini:/usr/local/etc/php/conf.d/php.ini - ./web:/var/www/html:delegated - ./assets:/var/www/html/site/assets:delegated composer: image: "composer" volumes: - ./web:/app command: install --ignore-platform-reqs myadmin: image: phpmyadmin/phpmyadmin container_name: phpmyadmin ports: - "8080:80" environment: - PMA_ARBITRARY=1 - PMA_HOST=${MARIADB_HOST} restart: always depends_on: - mysqldb mysqldb: image: mariadb:${MARIADB_VERSION} container_name: ${MARIADB_HOST} restart: always env_file: - ".env" environment: - MYSQL_DATABASE=${MARIADB_DATABASE} - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} - MYSQL_USER=${MARIADB_USER} - MYSQL_PASSWORD=${MARIADB_PASSWORD} ports: - "8989:3306" volumes: - ./data/db/mysql:/var/lib/mysql:delegated my prod_docker-compose.yml version: '3' services: web: image: nginx:alpine volumes: - ./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf - ./etc/ssl:/etc/ssl - ./etc/nginx/default.template.conf:/etc/nginx/conf.d/default.template - ./logs/nginx/:/var/log/nginx - webroot-volume:/var/www/html ports: - "80:80" - "443:443" environment: - NGINX_HOST=${NGINX_HOST} command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" restart: always depends_on: - php - mysqldb php: image: app:latest restart: always environment: MYSQL_HOST: ${MARIADB_HOST} MYSQL_PORT: 3306 MYSQL_DATABASE: ${MARIADB_DATABASE} MYSQL_USER: ${MARIADB_USER} MYSQL_PASSWORD: ${MARIADB_PASSWORD} volumes: - webroot-volume:/var/www/html - ./assets:/var/www/html/site/assets mysqldb: image: mariadb:${MARIADB_VERSION} container_name: ${MARIADB_HOST} restart: always env_file: - ".env" environment: - MYSQL_DATABASE=${MARIADB_DATABASE} - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} - MYSQL_USER=${MARIADB_USER} - MYSQL_PASSWORD=${MARIADB_PASSWORD} volumes: - ./data/db/mysql:/var/lib/mysql volumes: webroot-volume:
    1 point
  32. I submitted an issue report: https://github.com/processwire/processwire-issues/issues/552 If you think, this should be fixed, please leave a comment on github. Thank you. I did not file this as a feature request because I consider it a bug. One would expect to display tabs as tabs and not as fieldsets. No matter whether in page edit or profile edit screen.
    1 point
×
×
  • Create New...