Jump to content

dragan

Members
  • Posts

    2,010
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by dragan

  1. dragan

    JSON POST woes

    I'm puzzled by something I thought would be rather easy: I want to send a request to a PW page. It's POST, and I define a header, and send data as JSON. I need to send data in the following format: $ POST https://mysite.com/foo/bar/ {"headers": {"Authorization": "Bearer API_KEY", "Content-Type": "application/json"}, "body": {"fields": {"Name": "<get name>", "Department": "<get team>", "Home Address": "<get address>", "Phone #": "<get phone>", "Personal Email Address": "<get email>", "Birthday": "<get birthday>", "Date Added": "<call>currentDate</call>" }}} This is supposed to be sent via a Chatbot engine (Dexter). In the PW page that should handle this, $_POST is always empty, as is $_REQUEST. Same for PW's $input or if ($config->ajax) {}. I get the header, but no data. So I dug deeper, and tried this: @ini_set("allow_url_fopen", true); @ini_set("always_populate_raw_post_data", true); $data = json_decode(file_get_contents('php://input'), true); $d = print_r($data, true); // I store this, along with the header infos and timestamp in a PW page-field (instead of using file_put_content) I checked page permissions, I made sure I use pagename/, i.e. with trailing slash only, to avoid stripping the header away due to redirects (which somebody in an older forum thread once highly suggested). I tried to send the same stuff that the chatbot does via CURL. Nothing. PW error logs don't report anything (site is still in dev-mode). PW 3.0.81 - everything else runs just fine. Any ideas what I should change? Any more PHP/Apache settings maybe? Help is highly appreciated.
  2. Thanks for all the suggestions. GreenShot didn't work (captured only closed dropdown, not the open state). PicPick works great Back to the original question: Here's what I mean... If I choose the option shown in single.png, the settings panel never shows up. If I choose the option shown in multiple.png, everything works as expected.
  3. Do you have any example URLs? Do you allow images inside WYSIWYG fields? Did you do any tests with desktop image-processing software (e.g. Photoshop vs. PW)? re: "setting in the module": Are you talking about a specific module? Why not post in that specific forum thread?
  4. I know. But if you choose the first page autocomplete in the dropdown + save, operator settings are not shown. (grumble... does anyone know how to create a screenshot of an open select menu?)
  5. Alright. If I choose multiple, I get this settings panel as well. Why doesn't it appear if I choose single page? o_O
  6. Wow. I don't even see such a section. I quickly switched to type select, and then I have only one text-input, but I don't see all these search operators. Or "fields to query for autocomplete" PW 3.0.81, btw.
  7. What could be the reasons why not all pages appear in my page referefence field with page autocomplete? I have a dozen pages that should appear, with a 4-letter string that never show up. My selector should be fine: parent=1041, template=project, id!=id, sort=vertec, include=all Where does it actually look for the suggestions? only default page-title? I tried with title and several other fields, also custom variations for the label, e.g. {vertec}, {title}, {client_name} {year} Q1: In which fields does PW look for autosuggestions? only title? Can it be configurable to look also elsewhere (let's say 3 text fields) Q2: Does my custom labeling actually change anything in the behavior of autosuggest? (I guess not) In my case, I have over 1000 pages under one parent. Using the other option "page-selector" is not a real option (paginate several times...)
  8. Just click on "add new image", and paste the URL.
  9. hmm, if you mean "moving" = moving image from image field A to B (and deleting the image from the source field A), I wouldn't know. But if you mean "moving" = duplicating an image from image field A to B (leaving the source image in source field A), then simply right-clicking on the source image, copy the image URL, and adding it that way would work. (at least with a really quick test on Chrome / Win) Not sure what the big picture in your scenario really is though...
  10. Same here. Also, I like to minify + concat everything and deliver just one css and one js file. (AIOM is handy for that, or you can use any Grunt/Gulp task for that) But when I'm in the early stages of setting up a site / app, or just want to play around with different libraries, I usually load everything from CDNs. Also, when it comes to upgrading frontend assets, I don't monitor every new release and run for the latest version. Priority number one is stability. Only when there's a good reason (security bugfixes or major new features that I know I will use), I upgrade JS stuff.
  11. Perhaps you can use this brandnew site profile? https://processwire.com/talk/topic/17926-rest-api-site-profile/
  12. Did you google? The web seems to be full of similar questions, e.g. https://serverfault.com/questions/677181/open-litespeed-permission-problems
  13. Try to refresh modules cache. Also, you could try to remove everything in the assets/cache folder.
  14. Can't you just configure your Lister with Disable "add new" page buttons? or set display: none on #ProcessListerResults + a button
  15. Right. That would be Datatables and Ion.RangeSliders.
  16. Well, today you'd use lazy-loading techniques (load 20 items on load, and then 20 more with "show more" etc.), therefore eliminating the need for classic pagination, or show the current page-set in the URL. With endless scrolling and pagination, you could try something like this: https://elkfox.github.io/Ajaxify/ Ajaxination - Normal pagination style but load the page without reloading, uses push states.
  17. I just made a test: opened an image on the web, right-clicked and selected "copy", then pasted the image into a CKEditor field with CTRL-V (Google Chrome, Windows10). This works (don't know if this works across all browsers and OS out there). Of course, the disadvantage is that such images are not automagically saved to the images PW field. And only for images that are already on the web somewhere.
  18. Thanks once more! Will try it out tomorrow. I see, Christmas is coming early this year Can you pls explain why this line is necessary? if($template_field->type == 'hidden') {
  19. I think so. At least in my setup: I use a generic "overview" template all over the place, that only acts as parent page (to group / store children). They're not even used to show anything in the frontend. Of course I know I could create a special template just for this use case, and have the in-built control with "only allowed templates for children". but afaik, there is no way I can restrict children templates from the page-tree, only on a per-template-basis. Well, unless there's a module that allows this...
  20. Users are pages. I guess the password is simply a required field. So, when you create a user via API, assign a password too.
  21. I have a question though: I have a template override for the title field in place. This works, but only in page-edit mode. i.e. I see my label + description when in page-edit view. But on this first "add new page" screen I only see the default "Title" label, and no description. Can I somehow force PW to use my template override on this screen? Or is it necessary for PW to first save the page, to apply this setting? (makes sense) Can I add two lines to the above code and "inject" my title-label & description? Edit: OMG, I use PW now what? since 5 years, or more? I should know better by now that it's as easy as this: $title_field = $form->getChildByName('title'); $title_field->label = 'my custom label'; $title_field->description = 'my custom description / help-text / instructions / examples'; $form->insertAfter($f, $title_field); sorry for even asking...
  22. Works like a charm. Thank you!
  23. Thanks a lot! Will try it out asap. Is the above code meant to be placed in site/ready.php, or do I have to create my own module for this?
×
×
  • Create New...