Jump to content

Brian Scramlin

  • Content Count

  • Joined

  • Last visited

Community Reputation

9 Neutral

About Brian Scramlin

  • Rank
    Jr. Member
  • Birthday 03/02/1987

Profile Information

  • Gender
  • Location
    Wabash, Indiana

Recent Profile Visitors

1,391 profile views
  1. I have been able to accomplish the task natively with: usort($meevo_response_array, function ($a, $b) { return $b['transactionDateTime'] <=> $a['transactionDateTime']; }); But if I can do it the ProcessWire way, I try to.
  2. @Robin S and @horst thank you both for your replies! I have attempted the solutions suggested and I continue to get the same error when calling $reviews->sort( 'transactionDateTime' ); I can successfully convert the entire multi-dimensional array to WireArray objects. However, as I mentioned, the same error persists. I believe my issue may be related to using the `->sort()` function with an array. Here is the schema I am working with right now: ProcessWire\WireArray::__set_state(array( 'data' => array ( 0 => array ( 'ratingCount' => 2, 'transactionDateTime' => '2020-08-20T16:51:41.5596530', 'employeeCode' => 'MELANIE', 'employeeFirstName' => 'Melanie', 'employeeLastName' => 'Slinker', 'employeeNickName' => 'MELANIE', 'serviceId' => '8f219595-6134-4b78-9f15-ac170120a95a', 'shortcut' => 'WHC', 'displayName' => 'Women’s Haircut/Style', 'clientId' => '41a15d6b-4c66-4b1c-b67f-ac1a0139e55d', 'clientFirstName' => 'Sue', 'clientLastName' => 'Lopshire', 'tenantId' => 0, 'locationId' => 0, 'sale_Seq' => 0, 'saleLine_Seq' => 0, 'employee_User_TId' => 'd9589557-cf37-42f6-80ed-ac06011afd19', 'rating' => 5, 'comment' => 'Love my cut. Melanie does a great job', ), 1 => array ( 'ratingCount' => 1, 'transactionDateTime' => '2020-08-21T12:59:32.2407132', 'employeeCode' => 'MEGAN', 'employeeFirstName' => 'Megan', 'employeeLastName' => 'Nierman', 'employeeNickName' => 'Megan', 'serviceId' => '8f219595-6134-4b78-9f15-ac170120a95a', 'shortcut' => 'WHC', 'displayName' => 'Women’s Haircut/Style', 'clientId' => '738b74f0-e984-4cef-ac61-ac1c010294fd', 'clientFirstName' => 'Danielle', 'clientLastName' => 'Bryant', 'tenantId' => 0, 'locationId' => 0, 'sale_Seq' => 0, 'saleLine_Seq' => 0, 'employee_User_TId' => '4af682b8-50e4-4617-b54f-ac0701204d71', 'rating' => 5, 'comment' => 'Love Megan! Always leave loving my hair!', ), ), 'extraData' => array ( ), 'itemsRemoved' => array ( ), 'itemsAdded' => array ( ), 'duplicateChecking' => false, 'sortFlags' => 0, 'useFuel' => true, '_instanceNum' => 0, 'localHooks' => array ( ), 'trackChanges' => 0, 'changes' => array ( ), '_notices' => array ( 'errors' => NULL, 'warnings' => NULL, 'messages' => NULL, ), '_wire' => NULL, ));
  3. Hello, I am attempting to I have a JSON array I am receiving from an endpoint. I convert this to `Array` with `json_decode` Then, I create a new `WireArray` and import it. My issue is using the `->sort()` function does not work because this array is filled with standard objects. I believe I need to convert these to `WireData` objects. Am I on the right track? $meevo_response_array = json_decode( $meevo_response ); $reviews = new WireArray(); $reviews->import($meevo_response_array); Here I am stuck: foreach ($reviews as $review) { // convert each $review object to WireData object }
  4. I thought that as well, but it did not change anything. I also attempted putting it in the <head> ... Does the Frontend Editor load its own version of JQuery? I'm loading the one recommended with Bootstrap 4.
  5. Hello, I have enabled Frontend Editing but it is acting strange. I realized in the console there were some errors: Uncaught TypeError: e.fx is undefined jQuery 6 JqueryUI.js:7:65158 and Uncaught TypeError: jQuery.getScript is not a function init https://nerdspecs.com/dev/thelook/wire/modules/Page/PageFrontEdit/PageFrontEdit.js?nc=1598035122:387 PageFrontEditInit https://nerdspecs.com/dev/thelook/wire/modules/Page/PageFrontEdit/PageFrontEdit.js?nc=1598035122:418 <anonymous> https://nerdspecs.com/dev/thelook/wire/modules/Page/PageFrontEdit/PageFrontEdit.js?nc=1598035122:422 jQuery 2 PageFrontEdit.js:387:11 init https://nerdspecs.com/dev/thelook/wire/modules/Page/PageFrontEdit/PageFrontEdit.js?nc=1598035122:387 PageFrontEditInit https://nerdspecs.com/dev/thelook/wire/modules/Page/PageFrontEdit/PageFrontEdit.js?nc=1598035122:418 <anonymous> https://nerdspecs.com/dev/thelook/wire/modules/Page/PageFrontEdit/PageFrontEdit.js?nc=1598035122:422 jQuery 2 Does anyone have any advice on where to look or what to do?
  6. I was mostly interested in the PHP variable insertion. That could make building ProcessWire templates pretty quick.
  7. Hello! I cannot find information on if/how I can change the login URL AFTER installation. I almost always change the default to /login/ and I went through the installation too fast and kept "processwire" Is there a way I can alter this behavior? Thank you!
  8. @wbmnfktr, Thank you for your reply and ideas. I have confirmed that in my config.php file my timezone settings are aligned with my local time. Is this the only place to check for timezone settings? How do I view mail settings?
  9. My confirmation emails are coming in around 12 hours after submission. Does anyone know what settings I can check on my server or the module?
  10. I have noticed that when using builtwith.com, ProcessWire does not show up in the stack. I wonder why that is? I don't know how many people utilize that site, but I often browse through it when I find an exceptional website or application, and I hate for people to miss the greatest CMS of all time!
  11. Thank you, everyone! These are helpful strategies and I will integrate them into my work. What a great community. Regarding the auto-pre/appending, this is documented on the PW (https://processwire.com/docs/tutorials/how-to-structure-your-template-files/) as Direct Output with Automatic Inclusions, but I know Delayed Output and Markup Regions are probably preferred and I will work on switching to those strategies.
  12. 1. Would the file be overwritten when upgrading PW? 2. BLAST! Thank you.
  13. I just wanted to share that I added an AJAX-powered gallery to an artist website that I developed and host: https://jackpinecreations.com/gallery/ There were two things that frustrated me about creating this. Perhaps you can show me a better way. 1. After creating my processing script, which I placed under /templates/scripts/get-items.php, I realized that I would get a 403, due to ProcessWire's routing and security. This forced me to have to create a template and page for this little script. This was frustrating simply because it seemed unnecessarily confusing. But worse, see #2. 2. I usually use config.php to prepend and append each of my templates with a head.inc and foot.inc, which keeps my templates easy to use and I don't have to go and use the GUI to do so on each template separately. However, since I realized I needed to create a new template and page so as to access it, whenever I sent POST params to it, I would get the header and footer along with it!!! I could find no workarounds and had to remove the pre/append calls in config.php and use the GUI on each template individually. Code Below if you're interested: HTML and JavaScript (forgive my sad JavaScript skills, I know this can be tightened up) <!-- Begin Grid --> <div class="container mt-4"> <div id="gallery" class="row"> <?php foreach ($page->children("limit=9") as $child): ?> <div class="col-6 col-md-4 gallery-item"> <a href="<?= $child->url ?>" title="View <?= $child->title ?>"> <img class="gallery-item" src="<?= $child->item_featured_image->size(640, 640)->url ?>" alt="<?= $child->title ?> Image"> </a> </div> <?php endforeach; ?> </div> </div> <!-- End Grid --> <div class="center-block text-center"> <button id="get-more-items" type="button" name="get-more-items" class="btn-vintage">Load More</button> </div> <script type="text/javascript"> var buttonGetItems = document.getElementById("get-more-items"); var indexStart = 0; buttonGetItems.addEventListener("click", function() { indexStart += 9; $.ajax({ url: '<?= $pages->get(1186)->url ?>', type: "POST", dataType:'json', // add json datatype to get json data: ({page_id: <?= $page->id ?>, index_start: indexStart}), success: function(data){ console.log(data); if (data[1]) { //for each element, append it. $.each(data, function(key, value) { $("#gallery").append(value); }); } else { $("#get-more-items").after('<p class="center-block text-center">There are no more items to load.</p>'); $("#get-more-items").remove(); } } }); }); </script> Processing Script <?php $items_array = []; $i = 0; foreach ($pages->get($input->post->page_id)->children->slice($input->post->index_start, 9) as $child) { $i++; $items_array[$i] = "<div class='col-6 col-md-4 gallery-item'> <a href='$child->url' title='View $child->title'> <img src='{$child->item_featured_image->size(640,640)->url}' alt='$child->title Image'> </a> </div>"; } echo json_encode($items_array); I love ProcessWire for hundreds of reasons, but I've been using AJAX more and more, and I'm not liking having to create templates to access scripts. Any advice?
  14. I am reading up on these links now. Thank you @bernhard!
  • Create New...