-
Posts
1,079 -
Joined
-
Last visited
-
Days Won
17
Everything posted by dotnetic
-
[Closed] How to disable sort in a find or findRaw query?
dotnetic replied to dotnetic's topic in API & Templates
This is really cool and does exactly what I want. Thx. -
[Closed] How to disable sort in a find or findRaw query?
dotnetic replied to dotnetic's topic in API & Templates
Thanks for your help, but I was a bit unspecific in my request. I actually want a findRaw and only query some fields of these pages, because it is much faster. And so getByIDs would not help me. Or can I combine it somehow with findRaw? -
[Closed] How to disable sort in a find or findRaw query?
dotnetic replied to dotnetic's topic in API & Templates
Here is my articleSelector in action. articleselector.mp4 -
[Closed] How to disable sort in a find or findRaw query?
dotnetic replied to dotnetic's topic in API & Templates
Yes, sure. I have my custom tabulator.info integrated to select which products in which order should appear in a category of a shop like "shirts for boys, single color", "shirts for girls, multicolor", "caps", "hoodies" and more. On the left you see a tabulator with all available products. When clicking a product, it is moved to the right tabulator, which displays the selected products. Then you can reorder the products in that second tabulator via drag and drop. When saving the page the id's and their order are saved to another field (selectedarticles). Later on the frontend, the products in this category should be displayed in the manually specified order. Sure, I could have created pages for this, but this would produce much overhead (as I have many categories and for each category you can choose which products and in which order) and I only need a reference to the original product page. I did something similiar like your example code, but it would be nice, if ProcessWire would provide a sort=false option or something similar to retain the order. -
[Closed] How to disable sort in a find or findRaw query?
dotnetic replied to dotnetic's topic in API & Templates
I don't want a reversed sort order. I want to retain the order of the id's that i specified. Take this query for example. $pages->find('id=8|3|4|2|20|2'); I want to get the pages in this order: 8,3,4,2,20,2 -
I want to find an array of pages in a specified order, but it seems that ProcessWire by default sorts ascending by ID, but I want to preserve the order in my query. Is there a way to do this? My query looks like this: $articles = $pages->find('id=4|2|1'); which gives me the result in this order: 1,2,4
-
Congratulations. A problem nowadays is, that people complain and ask questions before trying out things themselves and realize that it took way less time to set things up, then writing and asking.
-
I recommend using Rector for upgrading legacy code or modules. I have written a short introduction/tutorial how you can use it here: You can then select which files or paths should be updated and to which PHP version and it does automated safe refactoring on them. Most of the plugins should then work out of the box with PHP 8, I have converted several modules with it. New rulesets for rector are published whenever they are needed. It is a great tool.
-
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 reply
-
- 13
-
-
Hello @PavelRadvan. I don't know how much experience with ProcessWire you have, and why you chose it. You can definetly develop an application to search through the database, but as much as I love ProcessWire, I think there are better tools for this task. First you have to export the data from Access to a MySQL or MariaDB. Then I would recommend using a tool like Directus (free, open source), with which you could Add Directus to an Existing Database (learndirectus.com) Or Filament (free, open source) which is a nice admin for databases and CRUD functionality. Or Laravel Nova.
-
Gratulation on the success of your daughter and thank you for the update.
-
Module Development: Inline Frontend Applications?
dotnetic replied to Inxentas's topic in General Support
alpine.js does not have any disadvantages to SEO, depending on what you do with it. I normally ship my modules with my custom code (if that is what you meant). I also include libraries like tabulator.info or alpine.js not using a CDN. -
this request was aborted because it appears to be forged
dotnetic replied to joshuag's topic in General Support
Do you also have TracyDebugger installed? I remember a problem in conjunction with SessionHandlerDB. If so, try removing the TracyDebugger files and if you can login then. -
Module Development: Inline Frontend Applications?
dotnetic replied to Inxentas's topic in General Support
First of all if you are coming from vue, alpine.js syntax might look familiar to you. You can think of alpine as TailwindCSS but for JavaScript. Both frameworks / libraries have small footprint, but serve different purposes. But the also share some silmiarities like declarative syntax and progressive enhancement. Here a some differences between htmx and alpine.js. Approach: HTMX focuses on accessing server-side functionality for creating dynamic components using AJAX, WebSockets, and Server Sent Events. In contrast, Alpine.js is an in-browser framework that brings the minimalism and simplicity of Vue.js to your markup, keeping the behavior and data manipulation on the client side. Data-binding: While Alpine.js incorporates two-way data binding and can manage multiple state objects with the $data attribute, HTMX does not offer full data-binding capabilities and generally interacts more with server-rendered content. Server-side vs Client-side: HTMX does not force you to use client-side rendering like many popular frameworks. It aims to work with server-generated HTML, which can be advantageous for SEO and page load speeds. On the other hand, Alpine.js is entirely client-side and handles creating and manipulating DOM elements using reactive data properties. Event Handling: Alpine.js includes event handling with the @ syntax, allowing you to attach event listeners directly to elements. HTMX, in contrast, primarily uses event handling for AJAX-related events like onLoad and onError. -
You can also build the whole application in the admin and have all of ProcessWire´s form validation and possibilities there, like dependend showing and hiding of form fields. I have built several projects for example a job application management system. room management. E-Commerce site with management from order to production inside of the admin. Some of my edit pages even have AJAX calculation fields in them. PDF and chart generation is another thing. I use the edit form of pages to manage different stuff. I also use CustomPageClasses to modify the forms inside of the admin. It depends, if the forms should be customer facing (to the public) or are they just for your client?
-
Do it now! It is easy to setup, and once you have it, you will never want to touch something other again.
-
I think maybe both variants should be in the same recipe. I am talking about the recipe creating a page via api. The published method is still viable, but there is also pages->new with a much simpler one argument syntax. So neither is right or wrong, better or badder, but a matter of choice.
-
The reason why I am asking for the release of v008 is because as the initial select I want to display a list of images instead of the title. Is this possible with v007?
- 96 replies
-
- 1
-
-
- chained-selects
- dropdowns
-
(and 2 more)
Tagged with:
-
@wbmnfktr Here are some thoughts for improvement and a question: A search function is missing. Would be great if it could be integrated. There are search functions that work with html elements, like Search, sort, filters, flexibility to tables, list and more! - List.js (listjs.com) but this solution would only work if all recipes are on one page, as it is right now. Going forth and back to see different recipes is not good for the eyes, because of the steady switch of backgrounds. I think it is better if you remove the blue background on the homepage and maybe add some shadows to the recipe cards then. It would be nice, if you can quickly navigate from one recipe to others. There are several ways this could be done. A search function would be one option, or an iframe as a sidebar with all recipes. How can I improve a recipe because there are better (newer) methods to accomplish the same? Create a PR for that recipe? Or create a new recipe with the same title with the improved method? There should be a ProcessWire version field, so someone knows that one method only works with a specific version of PW.
-
Was version 008 ever released? I bought this module some days ago, and received version 007 (codename James Bond).
- 96 replies
-
- 1
-
-
- chained-selects
- dropdowns
-
(and 2 more)
Tagged with:
-
Thank you @bernhard for this extensive post. I use RockMigrations every day and love it, as I stated often before. It isn't as hard as it looks at first. Just try it out and if you should stumble over something, then just ask for support here in the forum. RockMigrations saves much time and makes it easy to develop features in your dev environment and then when the feature is finished push the changes to the live server with migrations being executed automatically, which creates all fields, templates and even pages and contents. Could live without it, but that would be a sad life. So.... start using it now!
-
Did you find a solution yet? Depending on your host it could be that you can not make changes to your php.ini. The size of the setting could also be limitted by your web package that you bought. Some other hosters like Domain Factory use a user.ini instead of a php.ini in the root of your webspace, where you can make adjustments.