Jump to content

psy

Members
  • Posts

    620
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by psy

  1. @kongondo I purchased Padloper last week and would like access to the subforum too please ?
  2. Yes @pwired have heard all the arguments. The thing that annoys me most of all is Google. Google sprouts the importance of clean code, speed, well formed HTML, blah blah blah. My PW sites deliver and yet WP sites that fail with unrecoverable HTML errors, are barely responsive, have yawningly slow load times still rate in SERP pages. How does that work?
  3. Rather than saving the entire page when you're updating the 'mark' field, try 'setAndSave'. This will save only the nominated field and not trigger another page save event. https://processwire.com/api/ref/page/set-and-save/
  4. Quick update... my site already had a service worker registration file, PWABuilder. Each site can only have one service worker registration. With PushAlert's help, I managed to overcome this issue. Their software dictates that they register the service worker with a predefined file name, sw.js. Politely suggested they rethink this approach as other sites will have their own service worker registration files and who knows what problems may ensue if all vendors insist on their app registering the service worker? Awaiting outcome of that recommendation. Next, using the PushAlert cURL code, got notifications working on FF & Chrome. Haven't ventured into Safari territory yet as it involves a whole lot of baloney with Apple certificates. Sending notifications works well providing you don't mind getting double notifications when PWABuilder is installed with page cache/offline configured. Sigh... Plan is to continue development of PW integration with PushAlerts and, until service worker fluff is resolved, offer clients either push notification OR offline/fast page load. Will also do best to make calls to PushAlerts using WireHttp instead of their cURL code. Stay tuned!
  5. Thanks for the replies and all food for thought. Just to get things going, I've used the PushAlert's CURL code for now in the module and it's working fine. Will experiment more with WireHTTP later. Cheers
  6. Thanks @arjen I tried that with Postman and it didn't work. Suspect I had the right idea and wrong execution
  7. This may be a question for @ryan but will ask here as it relates to module development. I've begun development on a module to integrate PushAlert (https://pushalert.co/) with ProcessWire. Had a few hiccoughs along the way due mainly to the fact that my website already had a service worker. PushAlert support has been fabulous and I can now send push notifications from my PW website via their console and still use my own service worker code for offline cache. There are two PushAlert APIs - JS API and a REST API. Both are needed for my module and it's a WIP. Plan is when a visitor 'Allows' notifications from my site, the PA javascript API will capture the subscription ID and store it in a PW field on the user template. That bit is still to be written. First step is to send a push notification via the PushAlert REST API to all subscribers. PushAlert doesn't have a PHP library in GitHub but its doco does have examples, eg to send a broadcast notification to all subscribers: <?php $title = "Notification Title"; $message = "Notification Message"; $icon = "https://yourwebsite.com/icon.png"; $url = "https://yourwebsite.com/"; $apiKey = "YOUR_API_KEY"; $curlUrl = "https://api.pushalert.co/rest/v1/send"; //POST variables $post_vars = array( "icon" => $icon, "title" => $title, "message" => $message, "url" => $url, ); $headers = Array(); $headers[] = "Authorization: api_key=".$apiKey; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $curlUrl); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_vars)); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); $output = json_decode($result, true); if($output["success"]) { echo $output["id"]; //Sent Notification ID } else { //Others like bad request } ?> To send to an individual subscriber or nominated subscribers uses the same code with a few extra items in the $options array. The module config will store the API Key and the base API URL. The functions will allow the developer to enter the appropriate slugs, eg 'send'. All good so far... I could use their recommended CURL stuff but would rather use WireHttp. Questions are: Is it possible to convert the above CURL stuff into a WireHttp post and if so, how, especially how to code the custom headers? I saw in the WireHttp class that the 'sendCURL' function was commented out with: /** * Send using CURL (coming soon) * * @param string $url * @param string $method * @param array $options * @return bool|string * protected function sendCURL($url, $method = 'POST', $options = array()) { 3. If not (1), then when is 'soon'? All help welcome. psy
  8. Heads up for any PW developers who use parallax images on the front end of their sites. Chrome v67 has introduced a bug - grrrrr. A quick search found the solution for me: https://productforums.google.com/forum/#!topic/chrome/DC4IFvGXdIA;context-place=topicsearchin/chrome/category$3Awindows-10%7Csort:relevance%7Cspell:false In your CSS: /* google chrome 67 parallax bug fix */ .parallax { transform: translate3d(0,0,0); -webkit-transform: translate3d(0,0,0); }
  9. @neophron If I read your original post correctly, you want to target each subpage individually for CSS styling, eg background colour, after it's rendered on the home page. If so, then I would add a class of the page name and/or template name and/or page id to the subpage template, eg: // Sub page template <div id="p<?=$page->id?>" class="<?=$page->name?> <?=$page->template?>"> // Your field output stuff here... </div> This ensures each home page section has unique style classes and ids to target. Then use your first method to render the subpages on the home page, ie: <?php foreach($page->children() as $p){ echo $p->render(); // will render the above } ?> Your CSS would then look something like: .subpage-1 {background-color: blue;} .subpage-2 {background-color: red;} .subpage-3 {background-color: green;}
  10. @flydev Well spotted! Thank you ? Turned off LastPass and all good
  11. I do use LastPass but ensured that Barney's password field was blank before saving his record. When I changed Barney's username to 'barney', PW said the user already existed and changed it to fred-1, ie PW thought I editing Fred's record (I think!)
  12. I recently upgraded a client site to the latest dev version of PW. All good there. Then wanted to ensure another superuser used the UiKit theme without them having to do anything. Scenario with names changed to protect the innocent: My username: Fred Other username: Barney Fred logged in and edited Barney's user account. Username now shows as 'fred' with Fred's email address, ie PW thinks it's Fred although Display Name shows Barney Rubble and the page id is definitely Barney's. Barney's username and email address are lost??? Regardless of what I put in Barney's username field, PW still thinks it's Fred and changes Barney's username to fred-1 and puts Fred's email address in Barney's user record email field. Is this expected behaviour or a bug? How can I change Barney's user account back to its original values? - Using PW v3.0.106
  13. I find the Chrome/FF extension: http://www.colorzilla.com/ very useful
  14. psy

    PayWhirlAPI

    Hi @rareyush As an example, to retrieve a list of customers: The data returned is an array of Std Class objects. The error message you're getting, without actually seeing your test.php template, indicates a problem in your code. In the PayWhirl example, to get the first name of the first Customer, you would need: echo $myobj[0]->first_name; To get a list of all Customer first names: foreach ($myobj as $one) { echo $one->first_name . "<br />"; } Note the '->' to get the data from an object, not an array. Hope this helps
  15. A few very recent updates to the PWA story: Finally Apple iOS has support for service workers so PWA Builder works on iPhone Safari v11.3+ Google has released/updated its docs for building your own PWA scripts with Workbox. GitHub version updated 9 days ago The thing that interested me most, and the thing most requested by my customers, is entering data to forms when offline then auto-updating the db when online. Haven't tried it yet but https://developers.google.com/web/tools/workbox/ looks very promising, especially https://developers.google.com/web/tools/workbox/modules/workbox-background-sync Untested and maybe not the answer but at least the demand is recognised
  16. psy

    PayWhirlAPI

    @rareyush The module simply makes it easy to login in then use the PayWhirl API in ProcessWire. The documentation is at https://api.paywhirl.com/ Please paste your template code in here and I'll see if I can identify the cause.
  17. Couple of things to try: 1. Maybe turn formatting off, ie $bookdetail->of(false); 2. Maybe just saving the field will do, ie: // $bookdetail->save(); $bookdetail->setAndSave('bookings_done'); Untested...
  18. Discovered a 'gotcha' with PWABuilder. When a page should go to the Error 404 page, the offline.html page is displayed instead. Not helpful in this instance. Any suggestions on how to fix most welcome.
  19. Rebuilt my own site recently using all the knowledge, tips & tricks I've learnt from the PW docs, forums etc, including adding PWA features. Ran it through several publicly available audits and it passed OK - w3c validation, google page speed insights, google lighthouse, etc. Also engaged a digital marketing agency to audit it from a Google search POV. Still some tweaking to do on content & backlink fronts. Overall though happy with the result which could never have been achieved without the help and support of the ProcessWire community. Thank each and everyone of you. https://www.clipmagic.com.au
  20. @Eunico Cornelius Just a thought... on your template have you checked Disable automatic prepend of file: _init.php and/or Disable automatic prepend of file: _main.php?
  21. Try: <?php if ($page->id == 1 ) : ?> <div>your content</div> <?php else: ?> xxx <?php endif; ?>
  22. Welcome to PW and congrats on a lovely site!
  23. @Matze I've used this handy module: to generate content for fields. It's intentionally not automatic, allowing you to specify what/how much dummy content per field. You could maybe make it so with a hook to look for empty CK-Editor textareas on page load?
  24. Haha, me either but it does
×
×
  • Create New...