Jump to content

szabesz

Members
  • Posts

    2,932
  • Joined

  • Last visited

  • Days Won

    19

Everything posted by szabesz

  1. I'd like to highlight this because it only requires willingness and nothing more, but it would streamline upgrading efforts significantly. Enforcing it on 3rd party modules would also be welcome. See: https://semver.org/ The current versioning chaos is a drawback for sure.
  2. I do not think anyone suggested having "more" initialization methods. Instead, it would be nice to see fewer of them while still being able to initialize everything necessary. Most importantly, the documentation could be extended to show real-life examples of how to use Custom Page classes, including implementing some form of abstracted page request handling (both get and post) without having to use if/else trees at the top of template files. Regarding adding hooks, I use a static method, which should not incur any overhead. I explain it in this post of mine: Quote: /** * ... page specific hooks. This method is called from site/init.php from my custom loop * that runs for each frontend template based page. * if (in_array($templateName, config()->noneFrontendTemplates)) { * if ($templateName === "user") call_user_func_array("{$namespace}{$className}::initiate", []); // UserPage needs special treatment. * continue; * } * if (class_exists($namespace . $className)) call_user_func_array("{$namespace}{$className}::initiate", []); // Page classes register hooks in their initiate() method this way. */ public static function initiate() { parent::initiate(); wire()->addHookBefore("Pages::saveReady(template=product)", function ($event) { ... more hooks go here .... Having the code of hooks in the same file as the custom page class is a productivity booster for me. After all, in those hooks, the object we deal with is (mostly) a page object of that type. I would be happy to put that code in some other equally well-organized "spot" but putting hundreds of hooks directly into init.php and similar files is a big mess in my opinion.
  3. I recommend uninstalling it as it has more problems than features. See : https://processwire.com/talk/topic/23457-functionality-clash-with-system-notifications/#comment-215415
  4. https://hamy.xyz/labs/2024-01_htmx-vs-alpine Quote: "Low-js tools like HTMX and AlpineJS are the future of the web. They allow us to build modern web apps without the bloat of popular SPA frameworks." What perplexity.ai says: https://www.perplexity.ai/search/explain-the-pros-and-cons-of-l-IrCeVWXSTAWsWJEv_GuNIA Let's think forward...
  5. I use a mixture of calls to run various initializing code, depending on what to initialize, e.g., copied from a Product page's custom class: /* * Called when the page is requested on the frontend. * Called from _init.php via include_once(config()->paths->templates . 'path/to/this/_init_once.php'); * so that it only runs once per request: * page()->requested(); */ public function requested() { $this->request_ws = "\ProcessWire\RqtProduct"; parent::requested(); } /* * When initialization of object properties is required right from the beginning. */ function __construct(Template $tpl = null) { parent::__construct($tpl); $this->factsAy = new Arrayy([]); } public function ___loaded() { parent::___loaded(); // Either building a structured array of all product data and caching it in a variable or reading that from memory. if (empty($this->facts)) { $this->encodeFacts(); } else { $this->factsAy = Arrayy::createFromJson($this->facts); } } /** * Product page specific hooks. This method is called from site/init.php from my custom loop * that runs for each frontend template based page. * if (in_array($templateName, config()->noneFrontendTemplates)) { * if ($templateName === "user") call_user_func_array("{$namespace}{$className}::initiate", []); // UserPage needs special treatment. * continue; * } * if (class_exists($namespace . $className)) call_user_func_array("{$namespace}{$className}::initiate", []); // Page classes register hooks in their initiate() method this way. */ public static function initiate() { parent::initiate(); wire()->addHookBefore("Pages::saveReady(template=product)", function ($event) { ... more hooks go here ....
  6. I'd love to see an "officially supported and recommended (and even documented) way" of initializing custom page class objects, discussed and requested by us over the years: https://github.com/processwire/processwire-requests/issues/456 https://processwire.com/talk/topic/30138-page-classes-diving-into-one-of-processwires-best-features/?do=findComment&comment=242737 https://processwire.com/talk/topic/25342-custom-classes-for-page-objects-the-discussion/
  7. How to initialize a "custom page" object has also been discussed here before: https://processwire.com/talk/topic/25342-custom-classes-for-page-objects-the-discussion/ and is also discussed in this request at Github: https://github.com/processwire/processwire-requests/issues/456 I'd love to see an "officially supported and recommended way" of doing this.
  8. Sure, I also do that ? Thanks a 1000000 for sharing one of your modules again!
  9. Important to note that that module is no longer being maintained in favor of its commercial follow-up: https://processwire.com/store/login-register-pro/ Note that Ryan's modules are worth their price, and they are also secure. One can save a significant amount of time and receive quality support for the price. Compared to almost all other PHP CMS/CMF options out there, ProcessWire requires the least amount of time and effort when upgrading the system and its modules. You can keep a ProcessWire site online "forever" without the fear of it not being updated. The only driving force to update a ProcessWire site that is running fine is to keep up with PHP deprecations. Other than that, there are no maintenance tasks to perform if you are okay with a particular ProcessWire site. By purchasing the most important modules from Ryan (modules most important to you), you also support the continuous development of the system. At least that's how I look at it ?
  10. My recommendations for those who might be wondering...: I can also recommend even the free and public content of this site: https://refactoring.guru/design-patterns/php And if you have an actual task to solve, ask chat ChatGTP 4+ what it can recommend. And always ask it for more design pattern "ideas" since the random first one it recommends might not be the one that solves a particular problem best. After you have discovered the possibilities then sites like refactoring.guru and others can help with concrete implementation examples.
  11. @ryan That sounds promising, quote: TinyMCE for Open Source We recognize that the GPL may not align with the needs of certain free and open source (FOSS) projects. In response, we are introducing the TinyMCE for Open Source program that will provide a custom license to qualified open-source projects. This custom license will permit the use of TinyMCE 7+ in open-source projects with a license that is incompatible with GPLv2+. To apply for the Tiny for Open Source Program, please fill out and submit an application "there".
  12. I wonder what you exactly mean by that...
  13. Just a wild guess, but did you also try it with a different PHP version? Newer or older main PHP version?
  14. Perhaps it's not that it "does not get assigned" at all, but rather that it isn't assigned when your code expects it to be, because it hasn't been assigned yet?
  15. Hello Ivan, What do you mean by that? See: https://nativephp.com/docs/1/digging-deeper/databases
  16. https://nativephp.com/docs/1/getting-started/introduction "NativePHP is not a GUI framework. We don't want to tell you how to build your app. You can choose whatever UI toolset makes you and your team feel most productive." "#What's in the box? NativePHP comes with a bunch of useful features out of the box, including: Window management Menu management File management Database support (SQLite) Native notifications" What can I build with NativePHP? Honestly, anything you want. The only limit is your imagination. Now for building Windows apps too: https://github.com/orgs/NativePHP/discussions/278
  17. I would put it over here, on its on page: https://processwire.com/docs/start/install/ I put it on my todo list but I cannot promise anything as I hardly have free time these days.
  18. It would be nice to have a documentation page that lists all possible causes and fixes for this general error message. The forum is littered with requests for help regarding this issue, but I think in development mode there could be a link to a ProcessWire documentation page that actually helps to resolve it. There isn't an infinite number of things that can go wrong, and I think it would be possible to list them all, or at least almost all.
  19. I developed my first websites using SilverStripe. I did like it, but if a site was complex, upgrading to a new main version was not straightforward at all, and one had to thoroughly test everything to make sure all was good. I am glad I found ProcessWire afterward.
  20. If anyone sticks to using a version of PHP that old, I think they should also be okay with not upgrading modules.
  21. https://weekly.pw/polls/ Which PHP version are you hosting your ProcessWire sites on? (December 2020) PHP 5.6 or anything older than that (3.1%, 4)
  22. @netcarver Thanks! How about also adding robots.txt with User-agent: * Disallow: / plus <meta name="robots" content="noindex"> to head?
×
×
  • Create New...