pwFoo

Members
  • Content Count

    674
  • Joined

  • Last visited

Community Reputation

284 Excellent

About pwFoo

  • Rank
    Hero Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

6,801 profile views
  1. pwFoo

    Have to take a look, but messaging sounds great! encrypted would be nice! What's with group messages oder push notifications (web push)?
  2. pwFoo

    Looks like I should use a custom not Selectors object / class to build that. No working solution found / known.
  3. pwFoo

    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"
  4. pwFoo

    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)
  5. 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()?
  6. Looks like it works fine... Don't know what I done yesterday before I opened the topic...
  7. 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?
  8. Get it done with property lists for Page, PageImage and PageFile. Tested with PageArray, Page and Pageimage content.
  9. Hi @horst, thanks, but that doesn't work, because the needed properties are private You can get the value by "$obj->url". print_r works fine and show all the private keys / values, but if you convert to array / json the private properties not there. I haven't found a way to automate the list of keys or any way to loop through with all the private key => value pairs (image property url and some more are private!).
  10. I tried to automate without the need of a switch / case for different PW objects... If not possible I need some lists of properties of different ProcessWire objects... I don't understand why some default properties like url, path, ... are private. Would be easier if accessable (as it is with a simple "$url = $obj->url").
  11. So it's possible to get the value like that $url = $obj->url; but no way to get all the values with key / prop by loop or something else
  12. First print_r with the full object and needed data (items) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) Second print_r is empty. No attributes like url, description, ... Array ( [0] => )
  13. Again the code / post isn't shown correct... I split it up again... Forum bug?? print_r($value); $wa =newWireArray(); $wa->add($value); print_r($wa->explode()); First print_r ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) Ok, nice. All attributes are there... Also the needed attributes (url, ...) in "items" sub array. Second print_r miss all the expected data? Array ( [0] => ) Code with pagination in the forum ist strange... ??
  14. Some more tests without success... Object is fine: ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) ProcessWire\Pageimages Object ( [count] => 1 => /test2/ [field] => image [url] => /pw/site/assets/files/1022/ [path] => C:/xampp/htdocs/pw/site/assets/files/1022/ [items] => Array ( [tux.png] => Array ( [url] => /pw/site/assets/files/1022/tux.png [filename] => C:/xampp/htdocs/pw/site/assets/files/1022/tux.png [filesize] => 6705 [description] => Test1233 beschreibung bild [tags] => [created] => 2018-12-27 20:42:06 [modified] => 2018-12-27 20:43:30 [filemtime] => 2018-12-27 20:42:06 [width] => 225 [height] => 225 [suffix] => ) ) ) Try to convert it with WireArray (first print_r shows the output above! With all fields and items array) print_r($value); $wa =newWireArray(); $wa->add($value); print_r($wa->explode()); Result Array ( [0] => ) It's easy to output all the needed data, but not to get it to an array or object...??
  15. If I try to get all attributes (explode without param) it doesn't work. The result should be a array with all attributes, but it's just [image] => Array ( [0] => stdClass Object ( [0] => ProcessWire\ProcessWire Object ( [hooks] => Array ( [after ProcessWire::finished] => Template->hookFinished() in Template.php ) ) ) ) Testing some more ways (getKeys() + foreach for example...) to get all the attributes to a plain array...