Jump to content

KarlvonKarton

Members
  • Posts

    118
  • Joined

  • Last visited

Everything posted by KarlvonKarton

  1. I suspected that, but was not sure. They (Whoman2) say there are no problems... My opinion also, but this is what I get from the JSON: "UrlXXL":"http:\/\/gobert.websites.whoman2.be\/\/Pictures\/3394302\/1920\/5331ffa436e548f6ad34e8e0450f7992.jpg"
  2. I'm trying to sync a web service with Processwire and the API. I have this line in my code: $p->Pictures->add($picture['UrlXXL']); But from time to time I get following error. It is never the same picture. Error: Uncaught ProcessWire\WireException: File could not be downloaded (http://gobert.websites.whoman2.be//Pictures/2602849/1920/7dfad7eb252f4efaba17907bc69e35a3.jpg) 2: file_get_contents(http://gobert.websites.whoman2.be//Pictures/2602849/1920/7dfad7eb252f4efaba17907bc69e35a3.jpg): failed to open stream: Redirection limit reached, aborting (tried: curl, fopen) in /Users/iovalduc/Projectweb Media/Projecten/Immo-Gobert/Web/www/wire/core/WireHttp.php:703 Any ideas?
  3. About Admin: I have country pages I have destination pages with a pagefield destination_country (from countries) I have hotel pages with a pagefield hotel_country (from countries) Now I want a pagefield in destination (destination_hotels) that only shows the hotels with the same country as the destination, but my selector does not work (in sort settings for children). This selector works (but shows all hotels from all countries): parent=/hotels/, template=hotel, sort=title But this one does not show anything: parent=/hotels/, template=hotel, destination_country=hotel_country, sort=title Why does this not work? Any suggestions?
  4. Thank you, Robin S. Unfortunately when I do this: $field = $modules->get("InputfieldCheckbox"); $field->name = 'checkbox1'; $field->label = 'label'; $form->add($field); I always get this: PS: What I want is only the text next to the checkbox
  5. Could someone help me out a little? Thank you! Following code does not remove the label at all, but I can't seem to find the reason why. (I have tried skipLabelBlank too, same result) // create a checkbox $field = $modules->get("InputfieldCheckbox"); $field->attr('id+name','test'); $field->label = ''; $field->skipLabel = Inputfield::skipLabelHeader; // DOES NOTHING? $form->add($field); ps: I'm using PW 3.x
  6. I have a function in a custom class that works. But now I'm trying to connect to an external database, but this gives an error on this line (second version hereunder): $rs->setFetchMode(\PDO::FETCH_ASSOC); I'm a bit stuck... public function getFrontpagePropertiesList(){ $sql = "SELECT * FROM max_properties WHERE (client_var_368='1') ORDER BY max_properties.wijziging_datum DESC "; $rs = wire('database')->prepare($sql); $rs->setFetchMode(\PDO::FETCH_ASSOC); $rs->execute(); return $rs->fetchAll(); } public function getFrontpagePropertiesList(){ $dbm = new Database('localhost', 'user', 'PASS', 'db'); $sql = "SELECT * FROM max_properties WHERE (client_var_368='1') ORDER BY max_properties.wijziging_datum DESC "; $rs = $dbm->prepare($sql); $rs->setFetchMode(\PDO::FETCH_ASSOC); // THIS gives error $rs->execute(); return $rs->fetchAll(); }
  7. Like @K4mil I had to put 'nl_NL' in C (nl_NL for Dutch) to get rid of the warning, because the field C was empty.
  8. In the meanwhile I've tested the pageName with option Sanitizer::toAscii, but that still results in the same differences. So I'm sticking to this for now: // adding $saniName = $sanitizer->pageNameTranslate('Prospère Jouplaboum'); $u = $users->add($saniName); // checking $sane = $sanitizer->pageNameTranslate('Prospère Jouplaboum'); $exists = $pages->count("name=$sane") > 0;
  9. Then how can I check if user 'Prospère Jouplaboum' exists (when I search by his pageName)?
  10. Hello there, When I add a user and compare that with pageName, then I can see a difference with given $uniqueName. $uniqueName= 'Prospère Jouplaboum'; $u = $users->add($uniqueName); // Results in name: prospe-ere-jouplaboum /* VS. */ $username = $sanitizer->pageName(uniqueName); // Results in name: prospre-jouplaboum ps: to correct the issue, I had to: /* First pageName then add user... */ $uniqueName = $sanitizer->pageName($uniqueName); $u = $users->add($uniqueName); Strange, no?
  11. Can the $sanitizer still be used? (deprecated since 2.4) $user = $sanitizer->username($input->post->user); Or should we use: $string = $sanitizer->pageName(string $value);
  12. Last year I discovered Processwire (after the summer). I don't know why, but I had an immediate connection with it. Now I produced my new website with it. You can check it here: http://www.projectweb.be
  13. Oh! Silly me... I forgot that the $limit in the execute was still there... (that's what you get with C/P-ing) And of course yes, now the backslash is the solution. @adrian: correct, I should use FETCH_ASSOC (and maybe :limit too)
  14. Tried that already, with no success. But since I am using namespace, I thought it was not needed: <?php namespace ProcessWire;
  15. function getKappers($limit = 10){ $results_array = array(); $rs = wire('database')->prepare("SELECT * FROM appointment_kapper WHERE (actief = '1') ORDER BY volgorde LIMIT ?"); $rs->bindParam(1, $limit, PDO::PARAM_INT); // ERROR $rs->execute([$limit]); while ($row = $rs->fetch()){ $results_array[] = $row; } return $results_array; } Gives me this error and I don't understand why. Error: Class 'ProcessWire\PDO' not found Anyone? I suspect PDO::PARAM_INT ?
  16. What I usually do is layering two image divs on top of each other. One dummy image (low weight / one color ) in a div and on top of that an absolute div with the actual image as a background. This is a way of ensuring that the ratio stays the same, with almost no effort... ps: and it works well with the responsive block grid of Zurb Foundation (what I use instead of Bootstrap) -> http://foundation.zurb.com/sites/docs/grid.html#block-grids <div class="rasterblock"> <div><img src="dummy-image.jpg"></div> <div class="rasterinnerblock"> <div class="rasterimageblock" style="background-image:url(actual-image.jpg)"></div> </div> </div> <style> .rasterblock{position:relative;} .rasterinnerblock{ position:absolute; top:0px; left:0px; width:100%; height:100%; } .rasterimageblock{ width:100%; height:100%; overflow:hidden; background-position:center center; background-repeat:no-repeat; background-size:cover; } </style> Example: http://knokkehomes.be/verkoop/1/verkoop-vastgoed-te-koop-immo-knokke-homes.html
  17. Hello all, Just wanted you all to know that I found an excellent webhosting company for Benelux (where I live) and Europe. They are advertising Processwire on their frontpage, which is cool, is it not? What can Processwire want more than free publicity on hosting companies websites ;-) The link is: https://www.hosted-power.com/en/processwire Greetings, Karl.
  18. FYI I got it to work like so: // ... $p->files->add('http://www.somedomain.pw/files/somefile.pdf'); $lastfile = $p->files->last(); $p->of(false); // not sure about this $lastfile->set("description$en", $name); $p->save(); ps: save() can be after last()
  19. Thus? // get page // ... $en = $languages->get("en"); $fr = $languages->get("fr"); $p->images->add("http://www.somewhere.com/files/filename.jpg"); $lastimage = $p->images->last(); $lastimage->set("description$en", "Description in English"); $lastimage->set("description$fr", "Déscription en Français"); // ... // save
  20. It is the reference to the just added file what I'm struggling with. When I did: $p->images->add("http://www.somewhere.com/files/filename.jpg"); then how to reference (example) $images->last_added_image_file... (or something like that)
  21. Hi all, I could not find the answer to following question. How can I add multilingual descriptions to images or files with the API? $p = $pages->get(1234); $p->of(true); $p->images->add("http://www.somewhere.com/files/filename.jpg"); $p->save(); $p->of(false); I've been reading the link below, but can not figure it out in the above code... https://github.com/ryancramerdesign/ProcessWire/issues/496 ps: $images or $files are "Array of Items" in my case
  22. This module redirects to the custom page when page/ , But it does not redirect when page/list/ In the latter situation the pagetree is still visible. What can I do to prevent that? Is this a good practice to prevent it? public function viewable($event) { $page = $event->object; $user = $this->user; if ( ($page->id == 3 || $page->id == 8) && $user->hasRole('custom-role')) { $event->return = false; } } ps: thus with the extra added $page->id = 8
×
×
  • Create New...