Jump to content

Brian Scramlin

  • Posts

  • Joined

  • Last visited

Everything posted by Brian Scramlin

  1. Thank you @ukyo and @elabx this is exactly what I needed. I really tried to read through the API before asking, mainly because I didn't understand the relationship / order between everything. You guys are great!
  2. Hi, Everyone! I have been attempting to track down how to 1. Create a template 2. Add fields to it 3. Save it to database via the API. Can anyone get me sniffing in the right direction?
  3. 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.
  4. @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, ));
  5. 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 }
  6. 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.
  7. 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?
  8. I was mostly interested in the PHP variable insertion. That could make building ProcessWire templates pretty quick.
  9. 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!
  10. @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?
  11. 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?
  12. 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!
  13. 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.
  14. 1. Would the file be overwritten when upgrading PW? 2. BLAST! Thank you.
  15. 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?
  16. I am reading up on these links now. Thank you @bernhard!
  17. I am getting an error on line 21 for PW version 3.0.89 upon install. Something about the method needing the abstract keyword.
  18. Hello, I am newer to web development, but have fallen in love with Processwire over the past few years. I love the simplicity and flexibility of the entire platform. One area, however, continues to elude me: Modules. Desiring to respect the community, I have done my due diligence in reading other posts, the documentation, and learning more about PHP OOP so I better understand the syntax and patterns of Modules. But, I am still confused and was hoping some interaction would help me. For my first module, I am desiring to create a new Fieldtype which allows a user to Visually select an icon from the Font Awesome library (something like this https://codepen.io/scramlo/full/XGaOgv) Render markup. I have written the necessary parts of the module: <?php namespace ProcessWire; class FieldtypeIconPicker extends FieldType implements Module { public static function getModuleInfo() { return [ "title" => "Icon Picker", "summary" => "The Icon Picker module allows you to preview and render icons from the Font Awesome icon library.", "version" => 1, "autoload" => true ]; } public function ready() { if ($this->page->template == "admin") { } } } I have been looking at the FieltypeSelect and FieldtypeColorPicker modules as I thought I could learn from them. I see they both start by creating this function and returning the value. public function getInputfield(Page $page, Field $field) { $inputField = $this->modules->get('InputfieldColorPicker'); //lots of magic here return $inputField; } Where does this function get called? Please forgive me for my lack of understanding. Here are my confusions: I need to create a button that links to my module's JavaScript file. In my JavaScript file I can create a popup with all of the icons. When a user clicks on an icon, I need to set a value somehow in the database. I can use a hidden field if needed, I would suppose. I need to be able to render the output. I am guessing that in my module, something like the following is what I need: $iconMarkup = "<i class="fa " . $this->icon_class . "></i>"; Perhaps that is the return value of the getInputField function? Thank you for your patience and help. Please feel free to let me know if there is documentation I should have read, but missed. I want to work hard to fully grasp module development in ProcessWire.
  19. I am reading through replies, but wanted everyone to know as of one hour ago, I was able to reload backup from a couple of days ago. Thankfully my server configuration was set up to do this automatically. I'm new to this journey, and I will always be more careful. In fact, I am finally convinced I should have the following workflow: virtualized local configuration matching server config > commit to git local > push git to cloud > upload changes to live site.
  20. Macrura,

    I have a client who has grown beyond my ability to assist them. Are you available for a project quote? I can give you all the details. I came across you when I read about your experience with integrating foxycart with pw. 

  21. Hey everyone, I had one of the worst days of my life today due to the setlocale(LC_ALL,'en_US.UTF-8'); suggestion at the notification bar of my admin panel. I went into config.php, went to the last line and added setlocale(LC_ALL,'en_US.UTF-8'); Then my client's 30k/day site completely crashed. All I can get is the following output: 404 page not found (no site configuration or install.php available) Of course I removed the line of code and the problem is still there. In the midst of all of that I did NOT have the site profile exported, nor did I have a backup of the files and when I panicked I tried to upgrade the Processwire components, but in the fray of it all I recursively removed the assets folder--losing about 3-4GB of images and files. The client pays to get access to many of these photos, most of which are mug shots for newly released criminals and they do not have a local backup. So, I thankfully had a copy of all my templates, remade every one of my fields, and at least tried to get them publishing fresh again. Well, that same error showed up at the top of the screen. Guess what I did? The SAME THING!!! Only now I am BEGGING for help. I cannot start over again. Please, someone offer any advice. I thought I did EXACTLY what I was instructed to do.
  22. 1. After reading some documentation, there are fears I have about switching over to InnoDB. I will continue to read, but I decided not to delve into it without feeling more confident I can properly configure everything. Right now there is just as much chance as making things worse, than better! 2. That makes sense. The thing is, we are almost always under 3GB of memory usage (see attached image), but the "spikes" reach higher (I actually can't find out through any logs how high it reaches). But, I am not opposed to suggesting this if I run out of ideas. 3. No, everything is very basic. So, it sounds like what you are saying should be true: the pages are cached. 4. The below image is the only information on the memory usage I could find. In the past two days, it appears that we broke 5GB. I don't know what is "normal" for ProcessWire. I do find it interesting though, that the per/second memory was not increased during the above-5GB mark... so maybe it is just legitimate traffic overloading the server? The client already doesn't like spending $80-100 a month on server cost. Thanks everyone for your help!
  23. I did go through the modules. I don't think they could be causing the resource-spikes. ProCache Sitemap XML Hanna Code Template Editor Video Embed for YouTube/Vimeo Tracy Debugger And just recently Diagnostics
  • Create New...