Jump to content

da²

Members
  • Posts

    341
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by da²

  1. No hook involved (disabled all just in case). You're talking about the page setup/template/edit?id=2 (admin page template)? No I didn't defined a sort field. Field are sorted alphabetically in main menu, but not in fields page. I'm also not using tags, in case they change sort order. I can't even understand what is the sort order, as none of the columns is sorted. ?
  2. Hello, I don't know if I changed a parameter somewhere to do that, but fields are never sorted by name. I click "Name" column, but as soon as I change page and come back here it's again sorted in a way I don't understand. Filter options are set to "Show all". How to make this page default sort by name?
  3. Twig also is compiled to PHP, it's PHP code that interprets your method/property calls and fails on some PW properties for an obscure reason. Reading your link, the first talk is about this sh*t Twig interpretation. ? So at least this ugly behavior is not part of Latte. ? EDIT : Haha, and just now I'm searching something in my IDE and see an old Twig error log, showing how WIIIIIIIDE is this Twig interpretation:
  4. Hello, Maybe I will consider using Latte in the future. I love Twig but I have 2 problems with it: This two issues I'm reporting on this page, the second one is the worse because you can write a working code that will break in the future because a field value has became blank. I could use object.get('prop') everywhere but that's ugly and boring to type. The fact that it tries to interpret your property/method calls (maybe it can be disabled, I never searched), for example if I write object.method() and it's not found, it will also try object.getMethod(), object.method, and so on... So you can let typo in your code without knowing it if Twig found something else. On my custom page classes I can have a property prop (the PW field) AND a method getProp() (my own function that does more than prop) and they are not interchangeable even if they return same type of value. Could you tell me if Latte is doing the same 2 things? In terms of performance I didn't find benchmarks with latest version of both engines but I suppose they are close. I'm not sure yet what I'll use in my next project, I'm also interested exploring my own full-PHP method to get the best performances but that must be a clean solution, easy to read/update/reuse.
  5. Sure, but even taking small blocks to move to classes is not really usable. The box I took as example is just a bit of UIkit configuration in my project, mainly overriding UIkit variables. Depending of CSS framework used it will be different.
  6. On my previous project, a designer created a template on https://www.figma.com/. You can export design to CSS, I add a look at this code and it's a terrible thing. ? For example, this simple box... ...generates this mess: /* Frame 232 */ position: absolute; width: 460px; height: 580px; left: 490px; top: 425px; /* Ombre */ box-shadow: 0px 0px 10px 5px rgba(0, 0, 0, 0.5); /* Offre Gratuite */ position: absolute; width: 460px; height: 580px; left: 0px; top: 0px; /* Ombre */ box-shadow: 0px 0px 10px 5px rgba(0, 0, 0, 0.5); /* Rectangle 6 */ position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; /* Blanc */ background: #FFFFFF; border-radius: 10px; /* Pour accéder à notre outil, veuillez vous identifier */ position: absolute; height: 171px; left: 108px; right: 108px; top: 86px; /* Desktop - Texte courant */ font-family: 'Roboto'; font-style: normal; font-weight: 400; font-size: 18px; line-height: 21px; display: flex; align-items: center; text-align: center; /* Bleu foncé */ color: #02171C; /* Titre */ position: absolute; height: 86px; left: 0px; right: 0px; top: 0px; /* Rouge */ background: #E74342; border-radius: 10px 10px 0px 0px; /* J’ai déjà un compte */ position: absolute; height: 26px; left: 0px; right: 0px; top: 30px; /* Desktop - Mise en exergue */ font-family: 'Roboto'; font-style: normal; font-weight: 700; font-size: 22px; line-height: 26px; /* identical to box height */ display: flex; align-items: center; text-align: center; /* Blanc */ color: #FFFFFF; /* Bouton */ position: absolute; height: 55px; left: 0px; right: 0px; top: 485px; /* Frame 3 */ /* Auto layout */ display: flex; flex-direction: row; align-items: flex-start; padding: 15px 23px; gap: 10px; position: absolute; left: 23.48%; right: 23.48%; top: 0%; bottom: 0%; /* Rouge */ background: #E74342; border-radius: 30px; /* Se connecter */ width: 198px; height: 25px; font-family: 'Gilroy-Bold'; font-size: 20px; line-height: 23px; display: flex; align-items: center; text-align: center; /* Blanc */ color: #FFFFFF; /* Inside auto layout */ flex: none; order: 0; flex-grow: 0; /* Group 202 */ position: absolute; width: 380px; height: 85px; left: 40px; top: 230px; /* Identifiant * */ position: absolute; width: 380px; height: 30px; left: 40px; top: 230px; /* Desktop - Texte courant bold */ font-family: 'Roboto'; font-style: normal; font-weight: 700; font-size: 18px; line-height: 21px; /* Bleu foncé */ color: #02171C; /* Frame 3 */ box-sizing: border-box; position: absolute; height: 55px; left: 8.7%; right: 8.7%; top: 260px; /* Blanc */ background: #FFFFFF; /* Gris */ border: 1px solid #5E7F8C; border-radius: 30px; /* Votre identifiant */ position: absolute; height: 21px; left: 30px; right: 59px; top: 17px; /* Desktop - Texte courant */ font-family: 'Roboto'; font-style: normal; font-weight: 400; font-size: 18px; line-height: 21px; /* identical to box height */ display: flex; align-items: center; /* Gris */ color: #5E7F8C; /* Group 203 */ position: absolute; width: 380px; height: 85px; left: 40px; top: 335px; /* Mot de passe * */ position: absolute; width: 380px; height: 30px; left: 40px; top: 335px; /* Desktop - Texte courant bold */ font-family: 'Roboto'; font-style: normal; font-weight: 700; font-size: 18px; line-height: 21px; /* Bleu foncé */ color: #02171C; /* Frame 3 */ box-sizing: border-box; position: absolute; height: 55px; left: 8.7%; right: 8.7%; top: 365px; /* Blanc */ background: #FFFFFF; /* Gris */ border: 1px solid #5E7F8C; border-radius: 30px; /* Votre identifiant */ position: absolute; height: 21px; left: 30px; right: 59px; top: 17px; /* Desktop - Texte courant */ font-family: 'Roboto'; font-style: normal; font-weight: 400; font-size: 18px; line-height: 21px; /* identical to box height */ display: flex; align-items: center; /* Gris */ color: #5E7F8C; /* Mot de passe oublié ? */ position: absolute; width: 380px; height: 30px; left: 40px; top: 440px; /* Desktop - Texte courant bold */ font-family: 'Roboto'; font-style: normal; font-weight: 700; font-size: 18px; line-height: 21px; /* Rouge */ color: #E74342; Everything is absolute, font-family and other attributes are duplicated everywhere... There's almost nothing to keep in the final code. I wouldn't trust an AI generated code, and when you need to make changes you first have to learn what the AI created and to adapt to it, not my taste. I prefer to have full control on this and know what I'm doing.
  7. I don't know Swift but I see it's a language to develop Apple applications. At first instance I don't feel this is related with using static method in PHP, as it looks related with Python and multi-threading. ? EDIT: Just in case @donatas, are you using php-fpm? Because PHP error log could be in another location and not in Apache.
  8. There's always an error message recorded somewhere, if not in PW logs it's probably in web server logs. If @donatas is using Xampp on Windows, Apache logs are in xampp/apache/logs/error.log. Trying to understand an error without knowing the message is quite challenging. ? EDIT : But he should first look in PW Exception|Error logs.
  9. I use many translate functions in static functions without issue. Looks like a strange issue, maybe a PHP version difference?
  10. Look closely what the loop is creating, something is missing. ? <tr> <?php foreach($countymatch as $match): ?> <td></td> </tr> <?php endforeach; ?> You should indent your code to make it more readable and easier to debug. For example this is way easier to understand at first look (I didn't test it): <?php $countymatch = $pages->find("template=county-match-result, year={$page->id}"); ?> <table> <thead> <tr> <th>Opponents</th> <th>Venue</th> <th>Points for</th> <th>Points against</th> <th>Result</th> </tr> </thead> <tbody> <?php foreach($countymatch as $match): ?> <tr> <td><a href="<?= $match->url ?>"><?= $match->title ?></a></td> <td><?php if ($match->home_away->title == 'Home') echo "<a href='{$match->home_match_venue->url}'>{$match->home_match_venue->title}</a>"; else echo $match->away_match_venue; ?></td> <td><?= $match->cheshire_points; ?></td> <td><?= $match->opponent_points; ?></td> <td><?= $match->match_result->title; ?></td> </tr> <?php endforeach; ?> </tbody> </table>
  11. Hello, First you should start from a valid table skeleton: https://developer.mozilla.org/fr/docs/Web/HTML/Element/table Then your loop is not creating rows but columns, <tr> is a row and should have only 5 items in your case, but you're adding in a single row as much <td> as you have matches. Also you need a "==" here: if ($match->home_away->title = 'Home')
  12. It's probably a bad server/PHP configuration, maybe this will help: https://stackoverflow.com/a/36455035 Or ask your provider, I have no idea what they do with PHP. That's why I only own dedicated Debian servers in VPS, it's the same price and you are 100 % free to manage system configuration yourself, without the need of using graphical tools that you don't really know what they do. It requires knowledge in Debian and Linux administration but with Google everything can be learned.
  13. It's up to you, I know PW supports at least up to PHP 8.2. But if you don't use any new PHP feature you can stay with PHP 7.4. You only need to tick the ones linked with your error messages.
  14. I have no idea how they configure PHP, you probably already know this page: https://faq.o2switch.fr/hebergement-mutualise/tutoriels-cpanel/selecteur-version-php You may also try to install missing PHP modules corresponding to your errors (see video). Usually on Debian I only need to add this modules "php-mysql php-gd php-zip php-mbstring" but on another Linux distribution you have more or less to install.
  15. This returns only first level children. If you want grandchildren at any level I think you need to create a recursion function.
  16. Yes at least you'll get rid of errors if they prevent PW to work. There's also a database table "modules" that references installed modules I suppose, I don't know if it's preferable to remove module entry or not.
  17. Salut @Webjack, On va le faire en anglais si ça te dérange pas, ce sera compréhensible par tout le monde. ? Yes this is a PHP version issue, it's about union type "string | int" introduced in PHP 8. You have issues in your system installation, none of MySQL or other PHP extensions are found. These requirements are validated at the begin of PW installation. ProcessWire works fine with PHP 8+.
  18. You can hook "saved" method. When you don't want to trigger hooks on a page save you can use: $page->save(options: ['noHooks' => true]);
  19. @uzlander I'd use saveReady and isNew() to initialize a default value, so the hook only apply the first time page is created: $this->addHookBefore('Pages::saveReady(template=my-template)', function (HookEvent $event): void { $page = $event->arguments(0); if ($page->isNew()) { $page->myField = "myDefaultValue"; } }); Or like this, replacing isNew() by id=0 in hook selector: $this->addHookBefore('Pages::saveReady(template=my-template, id=0)', function (HookEvent $event): void { $page = $event->arguments(0); $page->myField = "myDefaultValue"; });
  20. It's hard-coded for now but I will eventually move it to a PW config page, so my clients can change it. Having it in a template wouldn't help because I highly discourage my clients to go in templates/fields area, it's way too much dangerous for a non-developer (their standard accounts can't access here).
  21. The first time I had a look to Drupal I didn't find how to create a basic page, like just... "can I create a template?", "where do I write php code?", "where do I add a <div>"? Sometimes I go in Drupal documentation, just having a quick look, there's a lot, a lot, a lot of documentation, there is so much to read, but for so little useful information. It's like a big wall where you would look for a door to pass through that you never find. I don't lose hope; perhaps one day I'll have enough motivation to find that door. ?
×
×
  • Create New...