• Content count

  • Joined

  • Last visited

Community Reputation

32 Excellent

About KarlvonKarton

  • Rank
    Full Member

Contact Methods

  • Website URL

Profile Information

  • Location
  • Interests
    Surf - Windsurf - Belgian - Music Producer - Ginger - Creative - Code
  1. 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(); }
  2. 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.
  3. 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;
  4. Super, thank you!
  5. Then how can I check if user 'Prospère Jouplaboum' exists (when I search by his pageName)?
  6. 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?
  7. 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);
  8. 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
  9. 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)
  10. Tried that already, with no success. But since I am using namespace, I thought it was not needed: <?php namespace ProcessWire;
  11. 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 ?
  12. 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
  13. 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.
  14. 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()
  15. 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