Jump to content

froot

Members
  • Posts

    707
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by froot

  1. OK so I guess it doesn't make more sense to anyone else out here either. Every time I try to use pagination I spend hours guessing and trying and when I get it to work, I'm back to where I started and I'm not one bit smarter than before because when at the time I will use pagination again, it might be a slightly different scenario that also will require hours of guessing. Here's what I'm trying now (for a different project) $start = $limit * ($input->pageNum() - 1); $allcasts = pages("template=cast"); // first store in in-memory db? $casts = $allcasts->find("has_parent=$page, sort=$sort"); // then find in in-memory db? $casts = sortOutEmpty($casts, $decider); $casts->setStart($start); $casts->setLimit($limit); // I use $decider as a variable so I can dynamically set a field that // depending if it's empty or not // decides whether the page should be displayed in the current language or not function sortOutEmpty($items, $decider) { $casts = new PaginatedArray; foreach ($items as $item) : if ($item->$decider != '') : $casts->add($item); endif; endforeach; return $casts; } The above doesn't work. I understand I need to set the "total" for the array but like I said, I never know how to do that properly. Thanks for help!
  2. could someone help me find the javascript bug? https://codepen.io/bbblgmsp/pen/LYxWJJa or here: https://foobar.roofaccess.org/carousell/ I want it to be NOT draggable on desktop but draggable on mobile devices. Also, on mobile, the element that I drag into focus should automatically be active, but on desktop, only when I click it. It works fine on desktop, but when you drag on mobile, after the dragged element is active and you click it, it switches back and forth between this and the previous element (assigns the active class to the previous element). I already tried to find help elsewhere, since this is not directly PW related but only frontend, but it's hard to find support or a community for uikit. PW seems to be using it quite a lot though… Thanks for help
  3. OK so this might be a very dumb/basic question which is why I can’t find any docs on this topic. I want to develop a module, namely a very basic e-commerce checkout function. For that to work, I need to store the purchases and the user input somewhere in the database. I haven’t really developed any PW module as such before, just simple pages with fields, any user input either ended up being sent via email or being stored in some field on the page. I guess it‘s not the best practice to create a field solely for that purpose on the page the checkout happens on, just as I‘m not putting the code on a page template either, since it‘s supposed to be a module and not just a page. The user input I would display in some sort of dashboard, somewhere on the module‘s admin page. So where and how and do I at all create a „fields“ for that reason or what is the right way to go about this? Thanks for help.
  4. still no progress… I don't see any place where to put the Client ID or the "Secret" or the Sandbox account email, just the Identity Token, the paypal email and the API endpoint. What am I missing?
  5. I'd like to create a slimmer version of the Page-Manipulator-Admin-action. For that purpose I would also need to simplify the array of type "selector", you know, where you select from all possible system fields and custom fields, operators and enter a value, and instead restrict it to only what I want the user to select. Is this selector field part of the AdminActions core module? or PW core? Can I accomplish that customisation all in the same array-item of the defineOptions function or should I create separate array-items for each criteria? Thanks for help!
  6. reCaptcha v2 invisible doesn't seem to be working (or what am I to expect? I've never seen an example for the invisible version anyway – kind of ironic, I know). I had reCaptcha v2 (the regular one) working just fine. Now that I want to change it to invisible I… added a new site-project in the reCaptcha-settings on google.com selected "invisible" in this module's settings and entered the newly created site key and secret key in this module's settings as well as in the div-attribute on the template. refreshed the page (cleared cookies and cache just to be save) but I see no change whatsoever. Thoughts?
  7. is this module discontinued?
  8. how can I return the type of an object? if it's a page array return PageArray. If it's a single page return PageObject etc. In plain php, this is done by gettype. When I use that here, everything is object, so it's not useful…
  9. [SOLVED] it actually started working for not good reason. I'm sure I tried before what I tried just now, but then it didn't work. Maybe by showing you the final code will clear things up $options = array( 'listClass' => 'inline-flex flex-center', 'linkMarkup' => "<a href='{url}'>{out}</a>", 'currentItemClass' => 'bg-red-400 text-white', 'itemMarkup' => '<li class="bg-green-400 px-3 py-2 {class} h-auto hover:bg-red-400 hover:text-white ">{out}</li>', 'currentLinkMarkup' => "<a>{out}</a>", 'separatorItemClass' => '', 'nextItemClass' => 'rounded-r-full', 'previousItemClass' => 'rounded-l-full', 'lastItemClass' => 'rounded-r-full', 'firstItemClass' => 'rounded-l-full', 'nextItemLabel' => '>>', 'previousItemLabel' => '<<', 'separatorItemLabel' => '<span>…</span>', ); thanks Edit: That said, what I don't like very much is the space between <a> and surrounding <li> tag which is not clickable but still changes its color upon hover. Hard to fix in this case at least.
  10. I tried that, doesn't help. If I do that, all look non-active. Both classes appear in the markup but the second one, coming from {class} gets ignored. That's why I thought that by having an array-item called itemClass, only one would be inserted via {class} and the problem I reckon would be solved.
  11. The $options array seems to be missing one crucial item, which is itemClass. BTW I'm using tailwind css, in case the classes confuse you a bit. I can't seem to style the <li> elements. If I add bg-green-400 to the classes of itemMarkup, it overrides the class of currentLinkMarkup. If I apply all the styling to the <a> tags instead, I cannot have a rounded corner for the first and last item. $options = array( 'listClass' => 'inline-flex', 'linkMarkup' => "<a class='px-2' href='{url}'>{out}</a>", 'currentItemClass' => 'bg-red-400', 'itemMarkup' => '<li class="{class} h-auto hover:bg-red-400">{out}</li>', 'separatorItemClass' => '', 'currentLinkMarkup' => "<a class='px-2'>{out}</a>", 'nextItemClass' => 'rounded-r-full', 'previousItemClass' => 'rounded-l-full', 'lastItemClass' => 'rounded-r-full', 'firstItemClass' => 'rounded-l-full', 'nextItemLabel' => '>>', 'previousItemLabel' => '<<', 'separatorItemLabel' => '<span>…</span>', ); thanks for ideas!
  12. @3fingers why is this so complicated? I thought an npm would do most of this work for me. I looked at some tailwind css tutorial (unrelated to pw), looked quite simple but I didn't know which folder to install tailwind into in my pw installation using terminal, so I came here. All of a sudden: install this, download that, run this code, then this, purge css, post css - super complicated! Why can't it be as simple as uikit?
  13. I'm trying to use Semantic UI on the frontend. I would appreciate some advice. Should I install the node.js NPM? I've never done that before. I ask because I started with simply using the "framework", components etc. i.e. just including the css and js files in the <head> tag which works fine for the most part, but I cannot use custom themes with this package. Any further help with that, that I research, always points towards using i.e. installing NPM. But then, I don't even know if that is possible with PW. Thanks for help!
  14. I did. In the module's settings I put the Identity Token (generated in https://www.paypal.com/businessmanage/preferences/website as suggested by paypal.com) and tried with API endpoint https://api-m.sandbox.paypal.com (as suggested by paypal.com) and https://www.sandbox.paypal.com (as suggest by this module). I entered my paypal email address, default currency (EUR) and location (AT). I put the code from the README file on the template and navigated to the page with that template plus get variable www.domain.tld?step=process However: if (! $response) { throw new \ProcessWire\WireException("Couldn't get access into "); } is what I get. Thoughts?
  15. apologies for the misconduct here in the forums, this happens when I don't start a new thread right away but actually start with researching existing posts to begin with, which I like to think to always do thouroughly. @Jan Romero as a matter of fact I do have ProFields Table and it is dope indeed, but like I mentioned in this thread here, I (and maybe others) would prefer the module I'm building and its dependencies to be free of charge, considering the still quite basic requirements it has to the tableish nature of the inputfield. I also use Tracy Debugger, but I'm not always sure how to use it though. I agree a table field is far more complex than say a checkbox field, yet it's still what is used to explain how to build a custom field, i.e. FieldTypeEvents, and my requirements not much different either, so I thought I give it a shot. Besides, I learn a lot more by doing than with too much theory. But maybe this is more long term project after all. Thanks so far everybody.
  16. I disagree, it is actually that hard : D All I'm trying to do is re-use the FieldTypeEvents/InputfieldEvents to build a sort of "week" inputfield, each table cell reprenting a individual checkboxes. So instead of 3 columns, it would have 7 (1 for each weekday) + 1 on the left. So I amended where those subfields are defined accordingly. However, now I get Call to a member function hasPermission() on null in wire/core/Modules.php:1389 Not sure if that tells anyone anything. Then I need to circle back to my db backup. Also, maybe a bit confusing in this particular case: Is $event always arbitrary, I mean coicidentally the name of the variable? Because you also have $event when using hooks which you can't really change, so need to be clear on this if this is prone to being confused.
  17. thanks @bernhard, it helps I'm still wondering though, as I want to create a custom fieldtype inside a custom module, should one module do both? or should one module require/install the other, i.e. two separate .module.php files or one .module.php file? Also, if I use two .module.php files, could both files be in the same module folder or separate? In my understanding, two folders would mean two modules, but I might be wrong. thanks for advice!
  18. When I create a new page, the name is auto-derived from the page's title. Can I simply skip that for a specific template so it stays empty and has to be entered manually?
  19. maybe a stupid question, I'm far from being an expert, but what's so exciting about avoiding the db in the first place? Aren't inputfields and inputfieldtypes not supposed to do nothing else than just that: insert data to the db? In other words, if you don't insert/input data in the db, why even call it inputfield? I'm trying to create an actual inputfield (that inserts data in the db) that I would use within a module I'm building. No sure if I would handle this separately or all in one module. I'm trying to start with FieldTypeEvents but it's indeed quite complex. I never know if what ever bit of code I'm looking at concerns the admin interface or the frontend. Also don't know why there are two files: FieldTypeEvents.module and InputfieldEvents.module. That goes for other Fieldtypes as well, I guess all of them.
  20. FieldTypeEvents is a separate fieldtype module. I understand it's just an example of how to create custom fields. I'm not sure though how that would fit in here – would I create that custom field that I need inside the module itself? Or would it also be a separate module that my custom module requires/installs? It actually seems quite basic in its functionality and comes quite close to what I need, but the code looks quite complex to be honest.
  21. of course, need to un-install and re-install, then it works. (I feel so stupid). Thanks
  22. ParseError syntax error, unexpected ''/templates/'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' I don't get it EDIT: I understand it needs to be $this->files->copy(__DIR__.'/templates/', $this->config->paths->templates); but still doesn't copy
  23. and a follow up question: if I do something like $src = $urls->site.'modules/myModule/templates/'; $dst = $urls->templates; $move = wireCopy($src, $dst); inside init() or ___execute() It of course asks for what is $urls. How would I pass it the $urls variable because if I just put it in the brackets, it's too few arguments where it's called, which I don't know where. Am I misunderstanding?
  24. thanks @ukyo I guess it works now, you're clearly in the user list. thanks for the tipp, what's the name of the FieldType? A sort of "range" input field that lets you drag with the mouse from start to end is cool for a month or year view but if you're trying to select multiple weeks over a a period of months, I reckon it's easier to just enter the week number and year. At least I couldn't find any time picker that makes this task easier, not in flatpickr nor anywhere, maybe something like drag or click the week number on a year calendar. And the other thing is entering times. The time input functionality from flatpickr is not much of use and dragging hardly could be an option since you would want to enter time slots and not so much ranges. So just having a simple text field is just as straight forward and probably more flexible.
×
×
  • Create New...