-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
If you're calculating the episode number manually anyways, why then use prev/next in the first place? I mean sorting and siblings and all that becomes basically irrelevant if you've a fixed order by epnum. Same for first/last – no need to use anything related to the siblings functionality. $nav_prev = $pages->findOne("parent=$page->parent, comic_epnum=" . ($page->comic_epnum - 1)); $nav_next = $pages->findOne("parent=$page->parent, comic_epnum=" . ($page->comic_epnum + 1)); $nav_first = $pages->findOne("parent=$page->parent, sort=comic_epnum"); // Get first in reverse order $nav_last = $pages->findOne("parent=$page->parent, sort=-comic_epnum");
-
Login with a link (is it called magic link?)
LostKobrakai replied to Ivan Gretsky's topic in General Support
The whole process is not that difficult. Create a long random string and store in in the db. When a link is hit, check the db for that token and if found (and still valid?) login the user and delete the token from the db. The only real pain point could be the "create a random string" part depending on how secure the whole thing should be. -
This sounds like you're missing a <?php or a ?> somewhere in that file either or some other syntax error, which puzzles the parser. Essentially the parser is mixing up php and html content different to what you intended.
-
I especially dig the last two use-cases. Debugging an issue on the live site by now used to be lot's of if($user==…) statements.
-
Did you read this one https://www.instagram.com/developer/? Since 1. of June one can only access the latest 20 images of up to 5 sandbox users without going through a app review by Instagram's staff. Hashtags will also only show media of those users in sandbox mode.
-
$pages->find("!my_repeater.my_checkbox<1"); This should work. It means find all pages where NOT at least one repeater does have an unchecked checkbox.
-
There's also something similar in the core. If you look here https://processwire.com/blog/posts/new-module-configuration-options/#using-an-array-to-define-module-configuration you'll see that module configuration inputfields can be defined by an array. This is also possible for custom created forms, as it's mentioned to the end of the text.
-
There's also https://www.padloper.pw/, which is also a paid module.
- 5 replies
-
- module development
- paid
-
(and 1 more)
Tagged with:
-
Available module functions and variables
LostKobrakai replied to benbyf's topic in Module/Plugin Development
There are various small modules to start from, which include the few basics and everything else is really up to what's needed for your module. There's Helloworld.module in each installation as a plain module (with opt. external config here), ProcessHello as starting point for custom backend modules and FieldtypeEvents for Fieldtype/Inputfield development. If you have those the best followup docs are probably processwire itself. Almost everything beyond the core is a module. You want to have a table rendered in an admin page – Take a look at e.g. ProcessField or ProcessTemplate, which both use such a table. You'll soon notice MarkupAdminDataTable with is another module just for rendering these tables. Basically everything with module infos and a way to tell it own classname is a module. It's described more detailed here: https://processwire.com/api/ref/module/. It can only get more detailed if one is asking for a module doing specific things, e.g. hooks, process modules, textformatters, error messages, table rendering and such. -
You should really test your selectors first before packing it into the paginator and trying to make sense of it. But I finally managed to setup a small test case and found a few issues, not releated to sorting, but to counting the total number of pages. It seems like there's no possible solution to wrap multiple selectors, where at least one does use or-groups, to one combined to run a $pages->count() on.
-
There is no $alreadySelectedElements, because we're not loading any items before those we really need. That's the crux in pagination. It should at best work without the runtime even knowing which items came before the current page, because otherwise there will always be scalability issues.
-
Yeah, that's probably the only way for this to work without needing to exactly know which items where in pages before the current. The NoDuplicates class is more a failed attempt
-
Ah yeah, sure. The items on page1 never make it into the $storage variable for page2, which I didn't really realize. So you'd probably need to make your selectors a bit more concrete, so they don't overlap. Otherwise we're back to loading at least all id's of all items.
-
@pwired This topic was moved to the dev section for exactly the reason of those tutorials not being about processwire. Also the thing is, as long as you don't understand php those fancy processwire snippets will always be a black box of magic and you won't be able to use them much more than for the exact use-case it was created for. Whereas with getting better at php you also start to see where those nice pw api abilities come from and how to use them on your own. It's not that black and white with learning things.
-
$markup = ''; foreach($languages as $language) { if($language->id == $savedLanguage->id) continue; if(!$page->viewable($language)) continue; $user->language = $language; // do not use $language here again $markup .= "<li class='language' style='float: left; display: inline; padding: 1em;'><a href='$page->url'>$language->title</a></li>"; } if(strlen($markup)) $markup = "<something>$markup</something>";
-
Testing with Phpunit, Processwire & PHPStorm
LostKobrakai replied to FrancisChung's topic in Tutorials
@FrancisChung Thanks for writing this tutorial, but I'd suggest changing the title. You're describing functional or integration tests and not unit tests. Unit tests try to test the smallest units of software with as few external dependencies as possible (e.g. a method or a class). Testing browser output is possibly the largest testable unit of a website. I know that these names are almost never used 100% correctly, but I think in this case it would really make sense to correct the terminology. -
Something like... repeater field with only one entry allowed
LostKobrakai replied to benjaminE's topic in Getting Started
The plans are there, but nut the time at the moment. -
Sort problem: Selector with date needs empty dates last
LostKobrakai replied to Xonox's topic in General Support
Nope, sort is only evaluated for the main selector part, but not for/inside or-groups. -
Newline characters are the de facto correct way of handling newlines in text. It's just that html does not care about them, which is why you need <br> tags instead.
-
Sort problem: Selector with date needs empty dates last
LostKobrakai replied to Xonox's topic in General Support
This one would also work, especially if you need pagination: https://github.com/LostKobrakai/Paginator -
Deleting fields directly from the field list
LostKobrakai replied to Juergen's topic in Wishlist & Roadmap
I don't think that would be a good addition to add to the core. Fields are one of the most precious constructs in ProcessWire in terms of possibility to delete data, therefore handling them lightly by default doesn't seems like a sensible move. -
It might be worth it
-
Probably the module itself. Just extend the class and replace the functions, where you need to change anything.
-
That's everything you can edit: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupPagerNav/MarkupPagerNav.module#L92-L159 If that's not enough, then you'd probably need to extend the module on your own.
-
Strategy for user-created data storage
LostKobrakai replied to bmacnaughton's topic in API & Templates
There are probably various examples of the plain pw api usage around in the forums. I've also started this one, to allow for a user-contributed migration "snippets" directory: https://github.com/LostKobrakai/MigrationSnippets Examples on how to use the specific helper migration classes of the module can be found here: https://github.com/LostKobrakai/Migrations/tree/master/migrations