Jump to content

pwFoo

Members
  • Content Count

    682
  • Joined

  • Last visited

Community Reputation

284 Excellent

About pwFoo

  • Rank
    Hero Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

6,910 profile views
  1. Yes, similar to that. PW template could bei used AS controller / return json, but requests for HTML / views should be redirected to another file (for example "./site/template/views/*"). But I don't know how to separate both. Easiest way should be urlSegments, but another way would be nice. Both requests could be ajax.
  2. I try to separate the requests for a template file (html) and the data / json and searching for a way to do it without enable url segments for each template (or enable by hook / api runtime). I'll build a autoload module and the request routing should be done there to send a template / view / html file OR execute the "controller" (page / PW template file) without the need of a switch case / if else inside of the page template file... Any idea how to do it? UrlSegments would work with for example first segment "template" or "view" to request the html file, but would be nice to do it without the use of segments (maybe needed for other things and default disabled). Any PW API way to do it by request content type, urlSegment / QueryString or anything else hook? Or a special "api" page which use urlSegments, load the page given by urlSegment and verify request type (html or json) by compare page path with (loaded page path)?
  3. Thank's, I'll test and compare the three hooks
  4. I know how to hook in page render, but what is the earliest hook into the ProcessWire page load? Should I hook (before) Page::render or is there a hookable method which executed earlier (for example if I check to skip current page load parts)? Also found Page::loaded?
  5. Hi, I play with something similar to service-pages and need to transport a selector and optional a field filter (for example to only get id, name, title instead of all the page fields). I set the selector as query string, /api/path?template=basic-page,field1=val1,limit=10 but how to set the field filter or split selector string from the field filter in parameters? /api/path?fields=id,name,title Can't combine the query string with selector and fields filter because of multiple "=" signs... How should it be done a clean / easy way? EDIT: Optional I use predefined selectors (more secure way too) only selected by path / urlSegments instead of selector in query, but would be nice to know how to handle it most flexible...
  6. Website https://wireshell.pw/ is offline. DNS_PROBE_FINISHED_NXDOMAIN
  7. Hi @Stikki, I'll take a closer look into you module code to see how filter feature could be added. Would it possible to add the JSON tab to user template too? I can't define the fields should be added to users if converted to JSON by your module?
  8. Is it possible to filter / extend page fields with function param like // only selected fields $myPages->toJSON(array('title', 'image'); // use "default" fields and add / remove fields $myPages->toJSON(array('title' => false, 'created' => true, 'addCustomField'); I know it could be done by a hook, set / modify fields by function param would be nice.
  9. Have to take a look, but messaging sounds great! encrypted would be nice! What's with group messages oder push notifications (web push)?
  10. Looks like I should use a custom not Selectors object / class to build that. No working solution found / known.
  11. Is there a way to redirect properties / fields to make them searchable by find($selector)? For example redirect a call to "$obj->prop<X>" to a function and return the needed value? Would that help to get find('prop1=myValue') work? I tried addHookProperty, but isn't usable for find(). $wa = new WireArray(); $obj1 = new Selectors('seg1=val1,seg2=val2'); $obj1->addhookProperty('seg1', function($event){ $event->return = $event->object->getSelectorByField('seg1'); }); echo $obj1->seg1; // "seg1=val1" $wa->add($obj1); $output = $wa->find('seg1=val1'); // object with items "count 0"
  12. To clearify. It is a PW Selectors object (not a custom class!) with dummy data. Because I need a selector (object) and some custom additional properties. Would be nice to just use the Selectors object with added properties searchable with find. And a missing part here. I tried to add custom properties to Selectors object, but get an error message: $this->property = 'value'; // ignored $this->set('property', 'value'); // error see below $this->addHookProperty(...); // error see below Error: Exception: Item 'selector' set to ProcessWire\ApiRoute is not an allowed type (in C:\xampp\htdocs\pw\wire\core\WireArray.php line 450)
  13. I played with the Selectors object and would like to use it for a special use case... That is a custom Selectors object with dummy data converted to an php array to see the structure (Selectors object is a WireArray with "fields" added) Array ( [0] => Array ( [0] => Array ( [field] => seg1 [value] => val1 [not] => [group] => [quote] => [forceMatch] => ) [1] => Array ( [field] => seg2 [value] => val2 [not] => [group] => [quote] => [forceMatch] => ) ) ) But instead of "seg1" the field name is "field" with value "seg1" (= my field name). So I can't search the Selectors WireArray (= custom WireArray with added Selectors objects) with PW "find('seg1=val1')", Is there a way to search with "find()" or build a simple wrapper to make the elements searchable / filterable with find()?
  14. Looks like it works fine... Don't know what I done yesterday before I opened the topic...
  15. With JS fetch() it is a bit tricky to get for example $_POST populated (params need to be FormData / forms), but would it possible to get PW $input (get, post, urlSegments, queryString) working for fetch requests? Is there a fix / hook / workaround to solve it PW side?
×
×
  • Create New...