Jump to content

AndZyk

Members
  • Posts

    608
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by AndZyk

  1. Thank you @bernhard for pointing me to this thread. This explains why this behaviour is necessary, although I wish it wouldn't. 😀 Then I will stick to my hook solution, if this is a recommended solution for this case. So far I haven't used custom page classes, but thanks for the hint.
  2. I have figured out which hook suits my case and decided to pre-select the options with the pages added hook: // Hook after page added $this->addHookAfter('Pages::added', function(HookEvent $event) { $page = $event->arguments(0); if ($page->template->name === "job") { // Pre-select job buttons $page->setAndSave("jobButtons", [1, 2]); } }); But I find this solutions still not very satisfying, because I think it should be possible to pre-select options without having the field to be required. Unless there is a reason behind, that I am not able to see.
  3. Hello, a client wanted to have the option to activate/deactivate two buttons on a page. But the default behaviour should be that both buttons are activated. So I have added a select options field with two options, which control if the buttons are visible or not. Now I can set both options to be preselected, but in order to makes this work, the field has to be required. But I don't want this to be a required field, because pages also should have the option to show no buttons. I honestly don't understand what's the reason, why this field has to be required, in order to show preselected options. Now I could add a third option "No buttons" or flip the logic to use this field for hiding butttons or I could use a hook for preselecting the options. But I am not sure which hook to use. But I hope there is a more elegant solution. Had somebody else this case before? I think this should be a common case. Regards, Andreas
  4. If the customer only wants to control the first level, then a page reference field should be enough. If the customer wants to control everything, then maybe a repeater with depth and page reference field should do the trick: https://processwire.com/blog/posts/pw-3.0.44-repeaters/ But I never had this case. Most clients want just rarely changes, which you can update in your code.
  5. As in my experience the menu usually doesn't change much, except maybe for submenus, I define the navigation in the _init.php and loop through the items and children: $homepage = pages()->get("/"); $nav = $homepage->children("template=foo|bar, sort=sort"); I try to keep the navigation connected to the page tree as close as possible.
  6. Hi @jetag, you could look here if there is still something: Source: https://documentation.mamp.info/en/MAMP-PRO-Mac/Servers-and-Services/MySQL/ This folder is hidden, so you would have to use for example your terminal: open /Library/Application\ Support/appsolute/MAMP\ PRO/db/ If you have a TimeMachine backup, you could restore the folder from your backup. Regards, Andreas
  7. The fieldtype repeater module is a core module and located under https://github.com/processwire/processwire/tree/master/wire/modules/Fieldtype/FieldtypeRepeater It should not be in the site/modules folder, you can just install it under Modules => Core.
  8. ProcessWire uses still a limited subset of Font Awesome 4 for the back-end. One solution could be to upgrade to Font Awesome 6 with 2000 icons in the free version: https://fontawesome.com/search?o=r&m=free Of course the Feather and Material icons are also beautiful.
  9. I can recommend the VSCode extension "Project Manager": https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager I have every project as own workspace with all root folders (site and wire) included and can easily switch with the project manager. The wire folder is excluded for opening files via the command palette. This way Intelephense knows everything, but I don't get suggested files in the wire folder. 😉
  10. Hey @bernhard, I have not tested @Jan Romero solution, but it seems like a nice solution for this feature. 👏 The only thing that could be changed is to use an own CSS class name for the download icon, so it would be cleaner. Also I am still unsure, wether this feature is so important for everyone, that it has to be next to the trash icon. But that is something @ryan has to decide. Regards, Andreas
  11. The code before was just a wild guess. But I have now tried it and it could work like this: // Add the download label to $this->labels // Somewhere at the beginning of ___renderButtons() $downloadUrl = $pagefile->url; // In ___renderButtons() for example after variations // Download $buttonText = "<i class='fa fa-download'></i> $labels[download]"; $buttonText = str_replace('{out}', $buttonText, $this->themeSettings['buttonText']); $out .= "<a class='$buttonClass' href='$downloadUrl' download>$buttonText</a>"; Here is a screenshot: If you make it to a link styled like a button and add the download attribute, there is no need to open a modal and it would download the file with just one click.
  12. Just my proposition, but maybe this option would be better located under the image edit buttons: https://github.com/processwire/processwire/blob/3acd7709c1cfc1817579db00c2f608235bdfb1e7/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module#L767 Because it is not a common option for everyone and the risk would be, that you download the file by accident if it is a button inside the image. Also you wouldn't have to change the SCSS file. It would be just something like: // Download $buttonText = "<i class='fa fa-download'></i> $labels[download]"; $buttonText = str_replace('{out}', $buttonText, $this->themeSettings['buttonText']); $out .= "<button type='button' data-href='$downloadUrl' data-buttons='button'>$buttonText</button>";
  13. I know that this is not the answer you are looking for, but at least on macOS I always open the image with the lightbox and then drag&drop the image on my desktop. That is not as convenient as a download icon, but three clicks less than Right click => Save image as.. => Select folder => Save 😉
  14. Awesome site, great job. 👍
  15. Hello @Roel, here is a tutorial how to upgrade ProcessWire: https://processwire.com/docs/start/install/upgrade/ For upgrading ProcessWire and modules I would recommend the module ProcessWire Upgrade: https://processwire.com/modules/process-wire-upgrade/ Regards, Andreas
  16. I am not sure, if this module works for exporting users as CSV. You could write your own CSV export script, like also mentioned in the thread posted above: Just write the code at the beginning of your template: <?php header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="blog-posts.csv"'); $items = $pages->find("template=blog-post"); echo "title,url" . PHP_EOL; // Add more fields here foreach($items as $item) { echo "\"$item->title\",\"$item->url\"" . PHP_EOL; // Add more fields here } return $this->halt(); For users this script could look like this: <?php header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="users.csv"'); $items = $pages->find("template=user, include=all"); echo "name,url,email,password" . PHP_EOL; foreach($items as $item) { echo "\"$item->name\",\"$item->url\",\"$item->email\",\"$item->pass\"" . PHP_EOL; } return $this->halt(); But the user password is stored encrypted, so I don't think that this would help you much. Or don't switch to WordPress. ? Regards, Andreas
  17. Hello @nicolant, maybe you could try this module mentioned here: But I would always store HTML, CSS and JS files in the templates directory. ? Regards, Andreas
  18. @sladedesign You mean the module BatchChildEditor? I don't have much experience with this module but you can enable the Export CSV mode under Mode Settings in the module configuration. There you can also configure the CSV export settings. Then you have to set where the editing tools are available and you can see them under the children tab of those pages. There you can export the children of the page as CSV. Do you want to export your blog posts from ProcessWire as CSV to import them into a WordPress website? Or what is it you want to achieve?
  19. Thank you for your explanation. In this case maybe a multi-instance or multi-site would be better: https://processwire.com/docs/more/multi-site-support/ I don't think it is possible to have two different home pages with one installation that easy. ?
  20. Hello @Manaus, it should be possible to create new pages without a template file. Does this template or the parent template some special restrictions under the Family settings? Regards, Andreas
  21. Thank you for explanation. This is working for me: <?php if ($input->urlSegment1) { $userID = $sanitizer->int($input->urlSegment1()); $u = $users->get($userID); if ($u->id) { if ($u->hasRole("login-register")) { echo $u->name; echo $u->email; } else { wire404(); } } else { wire404(); } } If you always get a 404 error, then maybe your ctype_digit check fails. Regards, Andreas
  22. Hello @Liam88, do you mean the free Login Register module or the commercial Login Register Pro module? I have no experience with the commercial module but I think neither require URL segments. You either just let the module do its default behavior: <?= $modules->get('LoginRegister')->execute() ?> Or you customize it: <?php if($user->isLoggedin() && !$input->get('profile') && !$input->get('logout')) { // you take over and render your own output or redirect elsewhere $session->redirect('/some/other/page/'); } else { // let the LoginRegister module have control echo $modules->get('LoginRegister')->execute(); } Source Regards, Andreas
  23. Hello @ZAP, this may not be the answer you are looking for, but I would really consider your approach in making a website available for multiple domains. For search engines that could be considered duplicate content and for users it could be annoying, because f.e. they would have to approve the cookie consent again. I would recommend you to figure out what the default language and domain of your website should be (English or Portuguese) and then redirect the other domain to the language of the default domain (portuguese.org to english.org/pt/). The default language (in this case english.org) doesn't require a language URL (/en/). If you look at major companies like f.e. Apple, Adobe, Microsoft or Amazon that is how they handle it. If you really want to do this, you could look at this solution: Regards, Andreas
  24. If you just want to delete all WebP files you also could do this via the command line in your site/assets/files: find . -name "*.webp" -type f -delete Source But only if you don't have WebP files manually uploaded in your file fields, so be careful. The module posted above is more safe I think. ? There was also a receipe by Ryan a while ago, but I cannot find it.
  25. In ProcessWire everything is a page. There is no separation between pages and posts like in WordPress. So yes, the solutions in this thread should work too. ?
×
×
  • Create New...