Jump to content

Jan Romero

Members
  • Posts

    695
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by Jan Romero

  1. The difference between the two snippets you posted is that $pages->find() will make a database query and $page->event_locations->find() filters the repeater items already in memory (a PageArray). Confusingly, there are some features that are only available in one or the other. My guess is probably the “today” condition doesn’t work with in-memory selectors, because it doesn’t know you’re comparing dates at that point. So under the hood it’ll be something like 1726956531 >= 'today' (or maybe '09/22/2024 00:08' >= 'today' due to output formatting, I’m not sure). As @da² suggested, try this: $pages->find('template=repeater_event_locations, event_date>=today, include=all, event_locations.owner.id=' . $page->id . ', sort=event_date, sort=location.location_city') That should get all repeater items from the database which belong to $page. If you want to use $page->event_locations instead, I would suggest just foreaching them and skipping the ones you don’t want. You’re going to foreach them anyway, so you might as well do filtering and output in a single loop. But the other option should be more performant, because you’re never loading the ones you don’t need.
  2. I’m assuming you do something like this: <a href="<?=$manufacturer->url()?>#siding">Get Wood</a> Go to the template settings of the $manufacturer page’s template and in the URLs tab, set the slash option to “No”: This will make the url() method generate links without the trailing slash and it will stop redirecting to the slashed version. That said, I’m pretty sure the links should work either way.
  3. Can’t you autoload your Process module? https://processwire.com/docs/modules/development/#automatically-loading-modules If you set 'autoload' => 'template=admin' in getModuleInfo() the ready() method should be called on every request within the PW admin. You can then determine if your hooks are needed as you’re already doing. I'm not sure what you mean by this, but you can use $modules->get('TestUpdate') to get an instance of your module? Yes, you can use $config->urls->admin, for example, but since you're creating a Process module, you should be able to get the entire URL using $this->getProcessPage(). That should be way to go since users can theoretically move or rename your Process page (as well as the Admin itself). If you're inside a request to the Process page, it will get you the current Page. Otherwise it will get the first page using the Process.
  4. Seconding this, of course! However, the WireCache fix reminded me of an old issue that still persists as far as I can tell 😉 No upvotes, but still feels like a bug to me: https://github.com/processwire/processwire-issues/issues/1604 It’s about the preloading feature preventing fresh cache values from being generated.
  5. AFAIK ProcessWire’s pagefileSecure feature only works on the page level. So when your page is viewable by guests, its files will be viewable as well. However, when pagefileSecure is active, all files should be routed through the hookable method ProcessPageView::___sendFile(). It’s a short little method you could hook to add your own logic. For example: $this->addHookBefore('ProcessPageView::sendFile(template=MY_SPECIAL_TEMPLATE)', function(HookEvent $event) { /** @var Page $page */ $page = $event->arguments(0); $filename = $event->arguments(1); if ($this->wire->user->isGuest()) throw new Wire404Exception('File not found', Wire404Exception::codeFile); });
  6. This was solved a couple of months after the OP by this PR: https://github.com/processwire/processwire/pull/161. See also the announcement blog post: https://processwire.com/blog/posts/pw-3.0.178/ Must be enabled in config.php: $config->wireInputArrayDepth = 2;
  7. Oh excellent, thanks! I’ve been asking myself this, but been too lazy to actually figure it out instead of just changing the table manually for project-specific modules 😄
  8. This is difficult to fix without more of the surrounding code. This isn’t on Github by any chance? If you’re not comfortable with fixing it yourself, you should probably give someone with expertise in PHP or ProcessWire direct access. Also please use the code formatting to post snippets, instead of quotes. Try to see if you can find where $contact is declared in the first 25 lines of structure.php. Apparently it’s a Boolean, but is expected to be a Page.
  9. Before PHP 8 you could put anything into the count() function and it would return 1 if it wasn’t null. The code in line 241 in includes/_head.php depends on this old behaviour, so you’ll have to rewrite it. Since there only ever seems to be a single image or none at all, you can probably just remove count() entirely: if ($page->eyecatcher) { … } There may be more instances of similar things in the codebase as PHP 8 deprecated several things. Shouldn’t be too hard to fix, though.
  10. I don’t pretend to have a good understanding of this stuff, but does the PW installer perhaps rely on output buffering to modify headers after starting the response body? Do the errors go away when you set this to 4096? Edit: I see this is exactly what the AI said. ignore me
  11. Gitea. I’m using it on Windows and it’s literally a a single executable that you swap for updates. Run it as a service with a Sqlite file next to it, done. Straight bussin, as I believe they say. https://about.gitea.com Also, I made my own little Pocket/ReadItLater thing using ProcessWire when Pocket started to get incredibly annoying a couple of years ago. It’s not presemtable, but I use it every day, lol.
  12. Did your hoster send you a scary email about the old Adminer script containing known vulnerabilities? Cause that happened to me ?
  13. That’s how you’re supposed to do it as far as I know. Just swap /wire/ and you’re done. See the docs for more details on .htaccess and /index.php, which you do sometimes need to update, but it doesn’t happen very often: https://processwire.com/docs/start/install/upgrade/ Non-core modules will be installed to /site/modules/ so they are not affected by PW updates. Don’t manually put modules into /wire/modules/! Indeed you should never* change anything in the /wire/ directory at all. *Of course, feel free to hack on the core as much as you like, but you’ll need to take extra steps when updating to avoid wiping out your changes. And updates may break your modifications in other ways, I suppose. I’m not sure it’ll break anything, I guess you’ll have to test it ? ProcessWire caches some information about installed modules in the “caches” database table, so you may need to delete that? But generally I’d imagine things to go smoothly. Yeah, if you update .htaccess you need to make sure to keep the changes you made to suit your environment. It rarely changes, though, so it’s not too messy to just check out the last handfull of diffs and see what you may need to add: https://github.com/processwire/processwire/commits/dev/htaccess.txt. As you can see, the last change was in January, but I’ve gone back a couple of years and really nothing critical happened.
  14. I have also started on this and I’m not sure how to approach it really. For instance, the sidebar with the authors is both kinda bad UX and wastefully implemented. Indeed the entire thing is wasteful as heck. Every time a book cover comes into view it preloads not only its entire details page, but also, for some reason, ONE MEGABYTE of random other stuff. Like check this out, this is what your browser deals with for EVERY book cover you see in that demo: [Removed because it triggered some kind of spam protection, lol. Sorry about that! Just check out your dev tools when visiting the demo from the OP.] Doesn’t seem like that much at first glance until you notice the weird repetition at the top and also, check out that horizontal scrollbar. Every book cover you look at seems to load EVERY AUTHOR EVER. Like… what? I’m not a galaxy-brained react dev, so maybe this is genius beyond my comprehension? Anyway I’m kinda not into loading all authors even once just to filter them client-side, but deviating from the orginal seems like a cop-out?
  15. This is so funny to me
  16. I don’t think that’s a bad thing per se, but I agree the big PHPStorm background could probably be replaced by just the slideshow of PW admin screenshots that currently plays awkwardly on top of it. Perhaps with one or two code screenshots intermixed. In general though, maybe I’m just old, but the site doesn’t look outdated to me at all? At least the frontpage looks as fresh as ever to me. Welcoming, professional, you name it. Certainly no worse than the examples mentioned? Wordpress has a trendy serif typeface which I get is part of their printing press shtick, but I honestly find kind of offputting for what it is (also the footer is grade A pure unadulturated organic cringe and all their images are blocked by Firefox’s default tracking protection). Structurally I think the ProcessWire site could use some improving, especially these “hub” pages like https://processwire.com/docs/, especially especially if they link to the next identical looking hub page (eg. https://processwire.com/docs/start/). Someone mentioned earlier that it’s a shame a lot of great nuggets and frankly vital info can practically only be found in blog posts. I know I’ve searched for specific blog entries I knew existed plenty of times, wondering how someone who hasn’t kept up with PW for over a decade would find out about stuff like custom user parents, for example. It would be great to have a more official tutorial section for these things which the blog posts would then link to. The current tutorial section only has 10 tuts, most of which, including the "More Tutorials" link, are secretly external.
  17. Sorry, I told you I was just guessing 😅 It should work using the updated code above. Apparently "owner" needs to be prefixed by the name of the repeater field. This time I have tested it.
  18. Would this help? https://processwire.com/blog/posts/processwire-3.0.95-core-updates/ I guess it would be something like this, but I’m on mobile, so untested: $pages->find("template=repeater_leaderboardCategories, carsOrCarClasses=5941, include=all, leaderboardCategories.owner.id=6057");
  19. It’s not a folder, but the URL http://localhost/processwire should be accessible and show a login form. ProcessWire dynamically handles such URLs using, among other things, the .htaccess rewrite* directives. I believe you’re asked to optionally rename the admin URL during the installation. Some people like to do so to obscure the login page from attackers. If you have entered a custom admin URL and forgotten it, you can check the database table “pages”. It should be ID 2. But maybe just try reinstalling from htdocs. It shouldn’t give you any htaccess problems IIRC. I spun up a PW installation on XAMPP on Windows only a couple weeks ago and I don’t recall having to change anything apart from enabling some optional php.ini features ?
  20. Yes, if you only plan to access PW on http://localhost I would just do that. If you want it to accessible at http://localhost/processwire-master I believe you need to add RewriteBase /processwire-master/ to section 8A in the .htaccess file. The processwire-master directory is only put there by GitHub, it doesn’t really “belong” to ProcessWire per se.
  21. Welcome to the forums! Are the site and wire directories directly inside htdocs, or within a subdirectory? You may need to check section 8A in your .htaccess.
  22. Obviously I haven’t used this myself I feel like there is some confusion in this thread regarding the storage model? My understanding is that the data in the database looks the same as any other field, ie. each field has its own table with subfields being individual columns. AFAIK that’s how Profields Combo works, which this has been compared to. That would alleviate @poljpocket’s concern about selectors. One would simply use the usual dot syntax. As with all dynamic db schemas the issue then becomes migrating data inbetween schema changes. „Stock“ ProcessWire helps you here by only allowing safe changes through the UI and/or showing warnings if data loss may occur. Such safeguards are presumably absent here, but I guess you’re supposed to know what you’re doing when dealing with code anyway.
  23. Neato ? You may want to turn this into a FieldtypeMulti to let PW take care of some of the database paperwork and get selector support for free.
  24. I don’t have access to those threads, but I have bought ProFields several times and one Table-adjacent thing I’d enjoy would be docs/improvements for paginated FieldtypeMultis. I know there is some support for this in the core but I’m not sure it’s meant as a public API. AFAIK it’s currently only used by Profields Table. In particular I’m not a fan of it using the global pagination by default. I seem to remember some ugly hacks to be required to get independent pagination per field.
  25. Full ack. I’ve long appreciated and admired the tasteful restraint with which Ryan has been steering the project all these years, but even so, PW has accumulated some features/concepts that could still use some love. The custom page classes being one hotly discussed example recently. A lot of the suggestions here would make for great third-party modules. If we want more module developers and more core contributors, an official test suite may be helpful, as would better docs and more developer relations like this (also possibly someone deranged spamming memes on twitter every 10 minutes). Obviously I say this with two hearts beating in my chest, because we all know the failure modes of playing these engagement-chasing games and of large communities in general. Regarding database abstraction, to be a little flippant, if I wanted to pay for or manage that kind of hosting, I would be building on ASP.Net Core and not use an insane language where 0 == null. I’m here because PW runs on little shared hosting plans for less than a cappuccino a month, I think a lot of us are, and as much as that sort of thing is derided and reported dead, it’s an okay niche to serve. (No hate here, I love Carson Gross, .Net, PHP and everything) It’s an absolute travesty that this sort of thing isn’t a browser feature. At least give us date ranges already.
×
×
  • Create New...