Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/07/2022 in all areas

  1. This week we have ProcessWire 3.0.206 on the dev branch and a new version of the ProDevTools UserActivity module, which we'll take a closer look at in this post— https://processwire.com/blog/posts/user-activity-v6/
    6 points
  2. @Boost Typically your _main.php would contain just the regions that would be common among all templates. Usually this is desirable because most websites have a common theme behind them. But if your template files are so different that nothing in <body>...</body> is the same, then maybe your _main.php is just this: <html lang="en"> <head id="html-head"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?=$page->title?></title> <!-- plus any other common head output --> </head> <body id="html-body"> <!-- any common body stuff, or even blank if none --> </body> </html> Then template file "basic-page.php" might look like this: <body id="html-body"> <div class="some-container-class"> <h1><?=$page->title?></h1> <?=$page->body?> </div> </body> and template file "gallery.php" might look like this: <body id="html-body"> <h1>Photo gallery: <?=$page->title?></h1> <ul class="gallery"> <?php foreach($page->images as $image): ?> <li><img src="<?=$image->url?>" alt="<?=$image->description?>" /> <?php endforeach; ?> </ul> </body> <!-- example of adding some JS and CSS files to the document head --> <script src="<?=$urls->templates?>scripts/gallery.js" pw-append="html-head"></script> <link rel="stylesheet" href="<?=$urls()->templates?>styles/gallery.css" pw-append="html-head"> <!-- or this does the same as the above with different syntax --> <head id="html-head" pw-append> <script src="<?=$urls->templates?>scripts/gallery.js"></script> <link rel="stylesheet" href="<?=$urls()->templates?>styles/gallery.css"> </head> I personally wouldn't create separate main template files like that and instead would just use a simple enough _main.php to accommodate anything I want to do with it. You certainly could use direct output too, and I'm guessing maybe half of PW sites do this. But consider the case above where we needed to add script/link tags to the document <head> from our template file. This is where direct output becomes more limiting, unless you want to start adding template-specific logic in other include files, like whichever one outputs your <head>. Either that, or you end up needing your template file(s) to each output an entire HTML document. So markup regions are really convenient in part because you can output directly (like direct output), but can also manipulate markup that's already been output, or will be output later.
    4 points
  3. Markup regions can keep your template files cleaner. Let's say for instance you have common header and footer section for all your pages. Without markup regions you might abstract these to include files and then include them in all your templates, for example: <head> [your template specific head content] </head> <body> <?php include($config->paths->templates . "_header.php"); ?> [Your template specific page content here] <?php include($config->paths->templates . "_footer.php"); ?> </body> Now this is fine if you only have 3 templates, but if your site grows bigger and more complex with possibly more include logic, that's where markup regions become of more value. In _main.php, I often have an empty <region id="pw-styles"> </region> just before my closing </head> tag, and a <region id="pw-scripts"> </region> before my closing </body> tag. Where I have a need for template-specific stylesheets and scripts (e.g for a lightgallery), I can just add these regions into those templates and put the necessary code in there.You can leave these entire region tags out of most templates, then just add them to the 'lightgallery' template, keeping your other templates clean. Over time you might find the need to add additional common code to all your templates. If your site has grown, this could mean updating a fair number templates with that code (or another include). With markup regions, you can just add this new code to _main.php and it's immediately included in all templates using _main.php. Meanwhile your template files remain clean with just their specific content, e.g. a basic page template might just be as simple as this: <region id="pw-content"> [your template specific page content here] </region> <?php include($config->paths->templates . "_main.php"); ?> And your _main.php would look like this: <head> [your common head content] <region id="pw-styles"> </region> </head> <?php include($config->paths->templates . "_header.php"); ?> <body> <region id="pw-main"> </region> <?php include($config->paths->templates . "_footer.php"); ?> <region id="pw-scripts"> </region> </body> Wheareas a template with lightgallery might look like this: <region id="pw-styles"> <link rel="stylesheet" href="/css/lightgallery.css"> </region> <region id="pw-content"> [your template specific page content here] </region> <region id="pw-scripts"> <script src="/js/lightgallery.js"></script> </region> <?php include($config->paths->templates . "_main.php"); ?> Whether that makes things clearer for you I don't know ?, but if you only have 3 templates for your entire site then using markup regions may be overkill.
    3 points
  4. I cannot vouch for any of this (just getting started with PW myself), but those are some links that I saved for future studying: https://www.pwtuts.com/ https://webdesign.tutsplus.com/categories/processwire https://mauricius.dev/tags/#processwire https://processwire.dev/ https://web.archive.org/web/20170816032544/https://abdus.co/blog/creating-a-simple-and-configurable-module-for-processwire/ Edit: Removed link to processwire-recipes(dot)com, as the website now links to an unsafe (adware / scareware) website...
    3 points
  5. I'll share my youtube videos in this thread and if you have questions this is the place to ask. You can also subscribe to this thread to get notified when I post new videos ? Here is the link to my channel: baumrock.com/youtube --- Hey! I've just published my very first ProcessWire video. It's about RockFrontend: https://processwire.com/talk/topic/27417-rockfrontend-??-take-your-processwire-frontend-development-to-the-next-level/#comment-225666 Here is the video: What do you think? Do you understand what I'm trying to explain (despite the many ääähms und öööhms...)? ? What about the length?? I really didn't plan do get to 40mins... Did anybody even watch it till the end? ? Would it be easier to follow when having a small thumbnail in the bottom corner when working on the code? Or better without? Is it worth the effort of creating a video or would a readme be just as good? ? Any tips for better sound/lighting? I'm not really knowing what I do, so any ideas for improvements are very welcome ? Better with or without background music? So many questions... So much to learn... ? But it's fun and I'm a bit proud ?
    2 points
  6. This week I've been working on something a little different: developing a new site profile in ProcessWire. Actually, I should probably call it an application profile rather than a site profile, as it's not a website profile. Instead it's a profile for an invoicing application in ProcessWire. Though you would install and run it on a web server, but it would be an independent application rather than part of a website... perhaps something you run in a subdirectory, subdomain, or even localhost. This is something I've been wanting to build for awhile—ever since the invoice service I use raised their rates beyond my budget. So I thought I'd build a replacement that I could use, as well as share for others that might have a similar need. I think it might also be a pretty decent PW profile example in general, too. I'd originally considered building it as a Process module but decided not to for a few reasons. Though the biggest one is that a site profile enables the greatest potential for customization and expansion according to each person's needs. Since you can expand upon it by adding your own fields and templates, or editing existing ones, most can really tailor it to their own needs a lot more easily than they could if it were a Process module. Likewise, since the actual invoices (and invoice emails) are rendered from front-end pages, you can customize the look and feel of them to match your brand very easily. (This is something I always wished I could do with the invoice service I've been using previously) This invoice profile requires nothing other than the ProcessWire core. It has no 3rd party or Pro module dependencies. I've got it largely functional at this stage, though will be putting a couple more weeks work into it before releasing it. I'd like to build in the option for clients to pay an invoice with a credit card (via Stripe) for instance. Below are a few screenshots of the work in progress. First is the page-list which shows the current invoices in the system and their status. (click image to view larger) As you can see, there are also pages for Clients and Settings. The client pages contain all the information about each client that invoices can be created for. The Settings page is where you can edit your own company information, logo and billing preferences. Next is the invoice editor. Here we have a repeater for each line item in the invoice. We also have a repeater for payments. All of the totals add up automatically as you type (Javascript added via hooks). They are also calculated automatically at the server side, so that everything stays consistent whether working with the API or in the page editor. (click image to view larger) At the bottom of the invoice editor you'll see a collapsed input for "Invoice action". This is where you can select actions to apply to the invoice. The two we currently have are "Email invoice to client" and "Email invoice to another address". Next up is what we see when viewing the invoice on the front-end. This is just the output of a template file but it is optimized for printing, saving to PDF and sending through email. I've kept it intentionally simple but of course the logo would be replaced with your own and all markup/styles are fully under your control. (click image to view larger) What I plan to add next are payment options, enabling a client to pay by credit card right from the invoice URL or email. What do you think, is this type of PW profile useful to you or someone you know? I've initially built it towards my own client invoicing needs, but I'm curious what other features you would like it to have? Or do you think it's better to keep it simple so that people can more easily take it in different directions? Thanks for your feedback. Have a great weekend!
    2 points
  7. I'm familiar with (a little bit about) container queries, but I haven't seen anything that would offer up automatic negotiation to forcibly size an unknown amount of text into a statically sized container without overflow. Thanks though! Lots of nice things coming to us via CSS, for sure. I haven't seen anything either, though since Tailwind seems to take advantage of CSS and JS, I wasn't sure if they might've solved this too. ? I've used fitty for a headline in one of the aforementioned slides already, though (at the time) it did have a few limitations. I see it's still getting updates, I'll have to look it over again. Thanks!!! I realize I kind of sidetracked the conversation on a bit of a tangent. Sorry! Overall this is a great topic though, Bernard!
    2 points
  8. Thx to another PR by @gebeer RockMigrations 2.0.9 can now also install System Permissions ? https://github.com/baumrock/RockMigrations/pull/14 * Usage: * $rm->installSystemPermissions('page-hide'); * $rm->installSystemPermissions([ * 'page-hide', * 'page-publish', * ); ?
    2 points
  9. We really like the ability to add redirects via the page editor, but it is annoying that this functionality is only available to superusers. We often have clients asking us to add a 'short url' redirect for a page (e.g. /jobs -> /about/work/jobs) when it really is something they should be able to do themselves. To solve this problem, we've created ProcessPageRedirects. It does two things: Creates a page (Pages > Redirects) which lists all the visible pages to that user and the number of redirects (among other things) Allows them to manage the redirects for pages they can edit The redirects editor is the same one the superuser gets when editing the page. I hope this is useful, let me know here if you come across any issues with it.
    1 point
  10. Coming to an IntelliJ IDE (like PHPStorm) near you soon. Live Templates or snippets provide a short way to write repeating code. You enter an abbrevitation and the editor completes the code for you. Here is one example when I want to setup a new module: phpstorm64_aT7Nj2gxSv.mp4 @bernhard Has snippets for VSCode in his great RockMigrations module also, be sure to check them out, if you use VSCode. As I use RockMigrations in every PW installation I also add snippets for migrations: phpstorm64_fAD9MoUJLE.mp4
    1 point
  11. In terms of cleanup? Cleaner to leave it on the floor. I think the random commentary bubbles and stock are funny though. It's hard to spice up dry material like coding, but I felt like these video have a good pace - I've watched them all through.
    1 point
  12. Ryan, This looks excellent! As always, ProcessWire just does it! I've been using Pancake for several years, and it has a lot of the features you're developing. I've been happy with it. But I'd MUCH prefer to do invoicing with ProcessWire, so my invoicing would be the same framework as all my web apps. As always, thanks for your amazing work!
    1 point
  13. Thx @gornycreative really happy to hear that! ?
    1 point
  14. This is great stuff - I love seeing how other folks work their process and it always gives me new approaches to try. I hadn't messed with latte at all before these videos (always got stuck using smarty and twig) but the simpler syntax looks awesome. Thanks for the work you've put into these modules and the videos!
    1 point
  15. @jrg don't forget processwire.rocks ??
    1 point
  16. I recommend RockFrontend(for LiveReload) + DDEV: a local web development environment system for PHP
    1 point
  17. Live Server Extension for VS Code + a browser extension for it are a tool to refresh any page in the browser when the watched code in VS Code changes. It can work with php-generated content - see here on how to set it up. Nothing unique to ProcessWire though.
    1 point
  18. @nbcommunication Ah, that makes sense now. Appreciate the clarification.
    1 point
  19. Yep. That's exactly it. My bad, docs are still lagging. This should be one of the following: <?php namespace ProcessWire; $p->productID; // aliases $p->lineItemProductID; $p->orderItemProductID; Let me know if it works.
    1 point
  20. Its a matter of taste and organization. You can have 3 pages and only one template. If services and about was using the same template basic-page, you end with only one basic-page.php template to work with. The strategy used and the templates are two distinct things. Add Pages to it, and its 3 differents things.
    1 point
  21. Thank you, @Robin S , for your answer. Yes, i am using the MarkupPagerNav. And have no idea why i didn't consider the MarkupPagerNav Docs... Instead i was focusing on the sanitizer class (s. below). However, with setting the arrayToCSV option to false, the arrays are kept in the original format indeed, but still looses their keys. http://<local-path>/?type_of_audience[]=1&type_of_audience[]=2 To keep the OP short, i didn't mentioned that i already use sanitizing and the whitelist to build the selector string for $page->find(). But didn't consider using it to set the values/states you suggested (and is shown in @ryan's examples). That's a neat idea. I think this is the way to go... Thx again, Olaf
    1 point
  22. No, it would terminate at 4096. Because this width is greater than the original, it won't generate a variation and it'll output the original as the source for 4096w. It then wouldn't make sense to output the original as the source for 2048w as it has already been used. This makes more sense in the smallest to largest context: 256 - variation generated 512 - variation generated 1024 - variation generated 2048 - width > than original, original used 4096 - set not output as original already used for 2048w. I hope that makes sense. Cheers, Chris
    1 point
  23. I presume you're using MarkupPagerNav. If so see the arrayToCSV option in the docs: https://processwire.com/api/ref/markup-pager-nav/#pwapi-methods-other-options But rather than change this option consider using the whitelist to store the sanitized search input and to set the values/states in your search form instead of using $_GET. See Ryan's Skyscrapers code for examples of how to do this: https://github.com/ryancramerdesign/skyscrapers2/blob/master/search.php https://github.com/ryancramerdesign/skyscrapers2/blob/master/includes/search-form.php
    1 point
  24. This resources list might also help you to get started: https://processwire.com/talk/topic/26720-using-echo-with-delayed-layout/#comment-221298
    1 point
  25. This is a nice showcase to demonstrate that even one of the oldest tutorials are still relevant today. ProcessWire is evolving in a way that basics never change and even backwards compatibility can be relied upon. Sure bugs come and go, but there is no complex software without bugs. Anyway, my recommendation form 2019: Not to mention: https://www.pwtuts.com/tags/ And some up to date tudorials from 2022: https://www.youtube.com/channel/UCvp33AwVHgFKgsrGaLh-ANg/videos Hope this helps.
    1 point
  26. I don't really bother because I use the pocketgrid css, which works with free to choose unlimited columns and free to choose unlimited breakpoints and blocks. I resize a website from wide screen to mobile screen and simply set breakpoints only where they are needed to resize a font, picture, margin, padding, etc, etc to make it look good. Contrary to something like Bootstrap would be very difficult because Bootstrap and the likes work with a limited set predefined breakpoints.
    1 point
  27. Hi @alexm, Strange. It works here. Both $order->payment and $order->paymentMethod should work (see TracyDebugger grab below). Screenshot Just confirming that you have a custom order-complete.php at /site/templates/padloper/order-complete.php ?
    1 point
  28. @ryanThis looks awesome! At first glance, the only thing missing for me is VAT. Do you plan to add that later? If not, how easy would it be to add this?
    1 point
  29. Basicly you have one folder for templates by default. This is configured to be in "site root" + templates/ You are able to overrule this setting from the site/config.php as follow $config->urls->templates = $config->urls->site . 'mytemplates/'; $config->paths->templates = $config->paths->site . 'mytemplates/'; A trick i use a lot when developing in a live site is to duplicate the template folder and rename the copy to templates-dev. Then make sure i have an other domain (or subdomain) pointing to the hosting, for example dev.domain.ext and for the live site on www.domain.ext With the following code i can access the development templates while normal visitors keep getting the default templates. /** * Development: Alias for template-dev access * */ if($_SERVER['HTTP_HOST'] == 'dev.domain.ext') { $config->urls->templates = $config->urls->site . 'templates-dev/'; $config->paths->templates = $config->paths->site . 'templates-dev/'; $config->debug = true; } You can make up all kind of 'rules' to go by when overruling the templates folder with php from the config.php file. For example serving the same site with different layout and code for mobile on m.domain.ext /** * Mobile: Alias for template-mobile access * */ if($_SERVER['HTTP_HOST'] == 'm.domain.ext') { $config->urls->templates = $config->urls->site . 'templates-mobile/'; $config->paths->templates = $config->paths->site . 'templates-mobile/'; }
    1 point
×
×
  • Create New...