Jump to content

fuzendesign

Members
  • Posts

    62
  • Joined

  • Last visited

Posts posted by fuzendesign

  1. I’m positive they weren’t rendering. I’ve been coding my page for days and couldn’t figure out why there was no output for them.

    My code makes the left and right arrows appear. (see screenshot)

    And your code shows 'prev' and 'next'. (see screenshot)

    I took the code I used from UIKit’s most recent docs. Either execution works for me. Thanks for adding your input.

     

    Screen Shot 2021-11-20 at 2.53.55 PM.png

    Screen Shot 2021-11-20 at 2.55.13 PM.png

  2. Referencing this page:

    https://processwire.com/api/ref/markup-pager-nav/

    The options array for UIKit should read as follows for nextItemLabel & previousItemLabel:

    // Change options for Uikit "uk-pagination" navigation
    $options = array(
      ...
    	'nextItemLabel' => "<span uk-pagination-next></span>",
    	'previousItemLabel' => "<span uk-pagination-previous></span>",
      ...
    );

    Otherwise with UIKit 3 the arrows don’t render.

  3. 30 minutes ago, totally not an htmx shill said:

    htmx supports using morphdom for swapping with the morphdom-swap extension

    agree 100% w/ @Craig's characterization of htmx as lower level than unpoly: it's an extension of HTML rather than a full framework (with, for example, a notion of layers).  That can be good or bad, depending on your needs.  Unpoly is a wonderful library that follows the same general html-oriented approach, but provides a lot more infrastructure baked into the core.  I think either one (or, hotwire, for that matter, which is even higher level than unpoly) is a great choice for html-oriented development.

    I obviously prefer the lower-level "improve on HTML" approach, but they all have plusses and minuses.  I'm (all to) happy to chat about htmx either here, on the htmx discord, or anywhere else.

    -t.totallyNotAnHtmxShill

    ? Introduce yourself!

  4. I installed it a few days ago on the recommendation of another developer here. It **is** awesome. I think it would take a while to understand its power but I was able to gleam a few things from it that helped. Thank you @gebeer!

    P.S. - Do I have to edit the title of this thread to “[SOLVED]"?

  5. On 11/5/2021 at 8:03 PM, Craig said:

    I'd like to add another vote to the notion of using something like htmx or Unpoly - I like them, a lot. Having used them on various projects, both have pros and cons (like most things) and satisfy different use cases.

    I know PW is quick, and the template caching improves on things, but I recently launched a site that made use of Unpoly's up-preload and up-instant functionality - the perceived speed of page loads makes it feel like a static site. The client's response on seeing the dev preview was "I was not expecting a like for like copy! Especially one that is that fast." (their emphasis; it was a redevelopment of a bad WordPress build).

    With Unpoly, I find the modal, popup and drawer UI are great. Having those integrated with the dynamic functionality is a plus, and means I don't have to worry about whichever underlying CSS framework is being used or pulling in a separate dependency to provide that. It's not perfect; some interactions, particularly nested ones, need a bit more care to make sure the server responses and front-end attributes are all present and correct. I also make heavy use of the "compiler" functionality. This is essentially your "$(document).ready()" equivalent which lets you initialise your client-side components (like maps or colour pickers, for example) on both initial page load as well as any time they happen to be added to the page dynamically via AJAX as the result of an Unpoly request.

    htmx sits at a bit of a lower level, and provides events and a plugin system to extend it and hook into different interactions. When you need to do client-side things, you will still need some javascript to get the job done; or you could use htmx's sister project _hyperscript.

    Either way, I'd be happy to see any of these become part of the PW admin. ? 

    Funny. Unpoly has been on my try list for months. I bookmark and articles I find. Same with HTMX.

  6. On 11/6/2021 at 4:29 AM, kongondo said:

    One of the many reasons I like htmx. It reminds me of ProcessWire a lot. Out of the box all it does is give you the necessary tools then stays out of your way. Even the author, for some reason, reminds me of Ryan ?

    So great to hear. I’ve been following HTMX for a while. I like the dev’s pragmatism. Makes me think of Ryan and PW also.

    • Like 1
  7. 22 minutes ago, wbmnfktr said:

    Are you sure that's valid (marked in bold)?

    wire()->addHookAfter('Pages(template=temp_order_detail)::published', function(HookEvent $event) { // }

    I could have sworn I grabbed that from code Ryan or an experienced developer here had use in answering someone’s question.

  8. Assuming I go with your code, just to test and using PW docs code—without specifying a template—my email still doesn’t fire on even the most basic example:

    (My understanding is that this should fire on any page being published on the site. I want to narrow it down to just a specific template, but reducing things to the most basic, can’t figure why this won't work…and yes, I tried various combinations of this code and other for the last few hours.)

    wire()->addHookAfter('Page::published', function(HookEvent $event) {
        // Get the object the event occurred on, if needed
        $pages = $event->object;
    
        // Get values of arguments sent to hook (if needed)
        $page = $event->arguments(0); // your code: $page = $event->arguments[0];
    
            $message = $mail->new();
            $message->subject('Hello world')
                ->to('externalemail@gmail.com')
                ->from('email@mysitedomain.com')
                ->body('Hello there big world')
                ->bodyHTML('<h2>Hello there big world</h2>');
            $numSent = $message->send();
    
    });

     

  9. I want to send an email when a page is published or updated. Specifically a template (temp_order_detail). For now, I just want to get the page-update code working. Why does the following code not send an email? I’ve tried using a from address of both my PW admin address and one tied to the domain the site resides on. Neither addresses work. Is there a whitelist in Processwire for valid emails to send from?

    I have this code in site > ready.php file:

    wire()->addHookAfter('Pages(template=temp_order_detail)::published', function(HookEvent $event) {
        // Get the object the event occurred on, if needed
        $pages = $event->object;
    
        // Get values of arguments sent to hook (if needed)
        $page = $event->arguments(0); // your code: $page = $event->arguments[0];
    
            $mail->new();
    				$mail->subject("Your order ".$page->title."has been submitted...");
    				$mail->to("testemail@gmail.com");
    				$mail->from("emailaccount@mydomain.com");
    
    				$mail = bodyHTML("<html><body><p>Your delivery order has been created.</p><p>Blah blah blah ".$page->title."</p></body></html>");
    				
    				$mail->send();
    
    });

     

  10. 4 hours ago, gebeer said:

    You are pointing to a solved thread and asking me for an answer. You say you are stuck but don't tell where you're stuck. I'm afraid I can't help you if you don't give exact details of your problem.
    EDIT: reading my reply again, it sounds a bit grumpy. That was not really intended. Just wanted to say that you have higher chances in getting a helpful answer if you try and explain your problem in more detail, possibly with some code that you already have.

    No worries @gebeer. You are correct, I should have just hooked into Form Builder and grabbed what I needed there. I’m learning as I go. I’ve never used hooks and this is my first true use of Form Builder.

    Your efforts were not in vain. I learned much from it that I’m using what I learned for another part of my mini app.

    The alternate direction I took was passing a Customer ID from form 1…onto form 2…and then querying the email there. It was a much better and smarter solution than I had initially planned since knowing the customer (ID) would allow me to auto populate a field with just **that customer”s** email, instead of sending all customer emails to that dropdown and expecting my client to choose the appropriate email tied to the customer. As you can imagine, not very smart but I was trying to bang something out that would hold me up for a week while I developed this app further.

    Also, I pointed to that other thread because it contained a similar problem I was encountering. In retrospect, I should have started a **new** thread on that post instead of posting to Solved. Another learned moment.

    And just yesterday, I understood why my code in that other thread wasn’t working.

    Thanks again for your initiative. The PW community is great.

    • Like 1
  11. 6 hours ago, gebeer said:

    Thanks a lot but no need.

    What are you doing with the form data once it is submitted?

    Instead of using my hook to alter the value in the form it would be much easier to hook into the processing of the form and get the email there from the ID and save it (just like @wbmnfktr suggested).

    I decided to take a different approach which kind of eludes to what you’re saying. I’ve split up my Form Builder form into two different pages. I'm passing the page reference ID to the second page. I’m not using a hook per se, but here’s where I’m stuck and once I have the answer then it’s smooth sailing. Perhaps you can answer:

     

  12. 2 hours ago, gebeer said:

    The option value is not visible to the user of the form. What are you using this form for and why do you need the option values to be email instead of ID? Please describe what you want to do with that form data. Maybe I should have asked that question before posting my solution above ?

    Yes, I know the value isn't visible to the user; I had my web dev inspector open and saw your code does exactly what I asked. The values _are_ being correctly assigned to the value attributes of the menu. Nothing wrong with your code and it’s much appreciated.

    But it’s my fault that I assumed saving would work without a hitch within Form Builder. Especially since the select menus are populated just perfect.

    The problem is that Form Builder’s seems to be stripping the values upon saving it to a PW page. Which tells me that I need to utilize a variation of your code _within_ Form Builder’s hook system. Otherwise it disregards certain things. Sort of like pre-populating fields needs to be done a “Form Builder way.”

    Direct Message me and I’ll drop a little something your way for your time.

  13. @gebeer That code works perfectly!…

    Unfortunately, I’m using that field within a Form Builder form. So after the Form Builder module saves the form to a Processwire page, it sends an empty value. On the form page itself, though, the select menu properly sees the code you supplied and the values in the select menu do show up properly.

  14. I created a select field that uses Page Reference. Works fine. But I don’t retrieve (and store) the ID of the referenced page, I want to use another field in that looked-up record as the value of my select/dropdown.

    Page Name: Temp Order
    Page Name URL: temp-order
    Field I want to grab: email

    PW makes it easy to assign multiple fields to comprise the ***label*** for that dropdown/select, but the ***value*** itself of the field is naturally hardwired to the page ID. That I understand.

    But how can Page Reference be used beyond retrieving an ID? And can that be done within the Selector String field in the Input settings for that field?
     

  15. On 4/9/2017 at 6:19 PM, Robin S said:

    There is limited (and undocumented) AJAX 'dependent selects' support built into Page Reference fields. You must use the 'Custom find' or 'Selector string' option for defining selectable pages, and reference the source Page Reference field (that exists on the same page) using syntax like this:

    parent=page.page_reference_field_name

    Based on testing I have found:

    • It only works for Select, Select Multiple or AsmSelect inputfields
    • It does not work inside a repeater item

    Does this solution require JS code or php code anywhere, other than the simple instruction you provided for code in the Selector String field?

  16. 13 minutes ago, cstevensjr said:

    I believe you can click on the red link to get the latest update (commit) for that version

    pw-upgrade.png

    @cstevensjr My bad. I thought I had the ProcessWireUpgrade module installed. PW has one called SystemUpdater which I thought was the same thing. Kind of confusing.

    I’ll hold off installing it since I see the ProcessWireUpgrade module page recommends manually updating 3.x.

    Are you running 3.0.29 and does the module work fine?

×
×
  • Create New...