Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/24/2023 in all areas

  1. This week in the blog we'll take a detailed look at the newest addition to the ProFields set of modules: the Date Range Fieldtype and Inputfield. This post serves both as an introduction to, and documentation for this new module. In addition, the v1 (beta) release of the module is now available for download in the ProFields board. https://processwire.com/blog/posts/date-range-fields/
    10 points
  2. Yeah, I'm using the same setup and it's absolutely great. Simple, clean, flexible, powerful. You can also access the $wire instance from every wire derived class, so you could also do $page->wire->foo->bar, eg $page->wire->pages->find(...). Many options ?
    3 points
  3. Yepp, good point about wire object. About 98% of my needs are covered by $page, $pages and $config. As I put my page/template related code/logic into custom page classes, it can be used via $page->method() inside my Latte templates too without extra injection. So my normal PW template files act as controller, my Latte templates as view and Page/Custom Page classes as model (at least sort of).
    2 points
  4. Hello @Gideon So, This works: $pages->find('file_field.filedata.uploadName%=230925_213339_R.json');
    2 points
  5. I brushed up my snippet with a ___getSelectorInfo method, so Lister & Co. can offer Length as a numeric subfield and put the module on GitHub.
    2 points
  6. @DV-JF Thanks for reporting. 1.5.62 released with fixes. Please test and let me know if all's good.
    2 points
  7. Introduction to RectorPHP In the dynamic world of PHP development, code refactoring is an inevitable task, whether for code optimization or transitioning to newer PHP versions. RectorPHP stands as a vital tool, simplifying this often challenging process. So, what is RectorPHP? What is RectorPHP? RectorPHP, or Rector, is a revolutionary open-source tool created to automate the process of refactoring PHP code. Refactoring, in simple terms, refers to the modification of a software system's internal structure without changing its external behavior, ultimately leading to enhanced readability and maintainability. Built on the powerful PHP Parser library, Rector analyzes and manipulates PHP code at the abstract syntax tree (AST) level. This granular control allows for intricate adjustments, making refactoring a breeze. But Rector's capabilities don't end here. Its true strength lies in its role as an automatic code upgrade tool. RectorPHP as an Automatic Code Upgrade Tool RectorPHP's primary role is to transition PHP code from legacy standards to modern, efficient, and more secure versions. This transformation allows developers to maintain their codebase up to date, benefiting from the latest advancements in PHP development. How Can RectorPHP Upgrade Your PHP Code? RectorPHP provides a smooth and efficient roadmap to upgrade old PHP code to contemporary versions. Here's how: Installation The first step is to install Rector in your project. Given it's a composer-based project, installing is as simple as running composer require rector/rector --dev in your terminal. Configuration Next, Rector requires a configuration file (rector.php) to instruct it on what to refactor. This file, located at the root of your project, should specify the rule sets Rector should adhere to. For instance, the following configuration upgrades PHP code to PHP 8.1: <?php declare(strict_types=1); use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ __DIR__ . '/src' ]); // register a single rule $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); // define sets of rules $rectorConfig->sets([ LevelSetList::UP_TO_PHP_80 ]); }; Refactoring With Rector installed and configured, it's time to initiate the refactoring process. Execute vendor/bin/rector process in your terminal, and Rector will begin refactoring your code, illustrating the changes as it progresses. Review and Test While Rector often delivers flawless results, it's still a good practice to examine the modifications it makes. Ensuring that the changes conform to your project's requirements and haven't led to any unforeseen behaviors is a smart move. To further ascertain that your system's functionality remains unscathed, it's advisable to run your test suite. Remember, these steps aren't strictly necessary, but they add an extra layer of safety to your refactoring process. Rector also provides a "dry run" feature, where it displays the proposed changes without actually modifying the codebase. This feature is useful to preview what Rector will do before allowing it to alter your project. Conclusion RectorPHP is an essential tool for PHP developers looking to modernize their codebase efficiently. By simplifying the refactoring process and offering a seamless upgrade path for transitioning to more recent PHP versions, Rector empowers developers to focus on crafting high-quality software. Utilizing Rector means keeping your PHP code in sync with the rapidly evolving landscape of PHP development.
    1 point
  8. Hi @bernhard, I've just encountered another issue, possibly because I'm working locally with Windows. The vscode block development shortcuts for Superusers aren't linking to the block view and block php files. Specifically these: They seem to both default to pointing at the \site\modules\RockFrontend\RockFrontend.module.php rather than the individual block/view files. I'm not sure why; maybe it's a difference in the information that debug_backtrace() returns on a Windows system? I don't know if this dump of the backtrace from getTplPath() is helpful: The icons seem to be using the first 'file' entry, although the link to the view file is there... Thanks in advance, Ian.
    1 point
  9. Sometimes, you want to search a text field by the length of its content. FieldtypeText doesn't provide this functionality (yet). It's possible to add the necessary SQL to a query by hooking into PageFinder::getQuery like @bernhard pointed out here, but that's of course not really straight forward. There's also an open feature request for FieldtypeText in processwire-requests. FieldtypeTextWithLength is an extension of FieldtypeText, so you can switch your field's type between the two without loosing any information. After switching your field to "Text with .length Selector", you can search by the (character, not bytes!) length of the content: $pagesWithShortHeadlines = $pages->find('headline.length<10'); You will also find a new "Length" subfield when using Pages -> Find in the PW backend:
    1 point
  10. I am very exited to launch PAGEGRID on Product Hunt today ? You can support it by upvoting or giving feedback here. And while you're there don't forget to give your love to processwire too. PAGEGRID is a friendly pagebuilder for ProcessWire. Learn more Thanks for your support!
    1 point
  11. You could also just pass the $wire object and from there you can access anything in your templates like $wire->pages->find(...) or $wire->foo->bar...
    1 point
  12. If you don't need that, don't use it ? I understand your arguments and I'm not going to try to convince you which way is better as both have pro's and con's. Just wanted to mention that idea of RockFrontend is to provide the tools you need and stay quiet in the background if you don't need them. If that's not the case for whatever reason I'd be happy to get a detailed report of the issue so I can fix it and make RockFrontend work in the way it's intended to work. If you do that or not is up to you. Just didn't want to leave that "RockFrontend broke my whole site" uncommented, as I'm putting a lot of work into my modules and I also try to make them as backwards compatible as possible.
    1 point
  13. There are listed only 2 models on my favorite comparison website: LG UltraFine 4K 24MD4KL-B, 23.7" - 3840x2160, 16:9, 186ppi - https://www.rtings.com/monitor/reviews/lg/ultrafine-4k NEC MultiSync EA244UHD-BK schwarz, 23.8" - 3840x2160, 16:9, 185ppi - https://www.tomshardware.com/reviews/nec-ea244uhd-4k-uhd-24-inch,3975.html If you could go with 2560x1440, 16:9, 123ppi there are a lot more and much cheaper options: https://geizhals.de/?cat=monlcd19wide&v=e&hloc=at&hloc=de&sort=t&bl1_id=30&xf=11939_20~11940_24~12018_110
    1 point
  14. Bernhards RockFrontend is at a complete different level than my two Latte implementations in this thread. If RockFrontend works for you, you may be better of staying with Bernhards module. It‘s by far more advanced than my code example and offers tons of other handy features like hot reload, translation functions from Latte templates and much more.
    1 point
  15. Hello I´m searching for a Developer that can help us on one of our projects. Its a Hotel Website wich should get a redesign of the Startpage, Flyout Menu. We dont have enough ressources to handle it. Should be about a one or two day job. New Screendesign of how it should look is already here. The Website is Processwire / uikit powered. (standard markupRegion setup) The changes will be mostly CSS (uikit) / HTML based. Project Deadline would be about Mid of December at the latest. Cost estimate after I give you the full details would be needed. Please write me a personal message if you interested. Thank you, Best regards Tom
    1 point
  16. Thank you for all your quick responses ?. I already found a Developer. best regards, Tom
    1 point
  17. Hello Tom, Hope you are well, I am interested in assisting you, thank you Scott Walter
    1 point
×
×
  • Create New...