Jump to content

KarlvonKarton

Members
  • Posts

    121
  • Joined

  • Last visited

Everything posted by KarlvonKarton

  1. I have been testing a bit more and I narrowed down the problem to just the size(600,0) part. So when I take an image and make a thumbnail of it with size() , then I get an E_WARNING. (I don't even have to save the thumbnail to another field) But I still have no clue why this happens.
  2. Hello, I'm filling an image field from an 3th party API with the Processwire API. All goes well: 1. images are correctly uploaded in images field 2. the first image is correctly converted to a thumbnail and added to another field (thumbnails) 3. the script does not break But: i get a warning like (example) on almost every picture (twice, what is more strange): exif_read_data(17-1.600x0.jpg): File not supported What am I doing wrong? My code: $picture = $this->getImageAPI($pic['mediumUrl']['href'],$pic['rentalUnit']['objectID'].'-'.$pic['order']); if($picture != ''){ $pictel++; $p->oe_images->add('./'.$picture); $lastPic = $p->oe_images->last(); unlink('./'.$picture); $p->save(); } if($pictel == 1){ $thumbnail = $lastPic->size(600,0); $p->oe_thumbnails->add($thumbnail); $p->save(); }
  3. Is this a bug? The digit (number of rooms) is visible in the default language (dutch), but not in the secondary language (french). The texts are translated. sprintf(_n('%d slaapkamer', '%d slaapkamers', $page->ska_NumberOfBedrooms), $page->ska_NumberOfBedrooms); example text dutch: 3 slaapkamers french: chambres à coucher
  4. $page->images->add($imgurl); So my question is: When I add an image like above, why this image is not resized to my setting in the field (set in admin).
  5. Is it true that when you add an image to the images field, that the image will be uploaded without taking the settings of that field into account? So if I set the input of the images field to max width: 3000px, then an image of 6000px width will stay that size after adding it with the API?
  6. If you need to output all the languages, but only want to show the title in native spoken, then I came up with this (maybe there is a better way?): foreach($languages as $language){ if($user->language->id != $language->id) echo '<a href="'.$page->localUrl($language).'" class="languagebtn">'.$language->getLanguageValue($language->name, 'title').'</a>'; }
  7. I had to create a similar selector today, so I share as an example: $paramdate = strtotime('2018-01-01'); $numPanden = $pages->find("template=panddetail,(ska_Status=FOR_SALE),(ska_Status=SOLD,ska_PropertyModified>$paramdate),ska_Project=0"); Why are you having round brackets around every field? My guess is that you only need brackets around the template field?
  8. The new website is OK, but the docs are unreadable for me. The contrast of the black code background with the white pages make my eyes hurt like crazy... Fix that please!
  9. I think you're right. I still wonder why the SQL is altered (RF or OS or combi OS/SQL), but I also understand now that I simply made the mistake by using uppercase for fields either way. Good to know for future projects...
  10. It should, but it doesn't change the outcome. (I've tried both upper or lowercase) Whatever I try (upper, lowercase), the SQL statement created by RockFinder is changing the name of the table to 'field_ska_City' while the name of the table is 'field_ska_city'... (in the last FROM - see SQL above)
  11. I have tried to execute the SQL with phpmyadmin on both servers (live and dev). On DEV it works, but not on LIVE. The problem is that RockFinder switches from uppercase to lowercase in the SQL. Just check this SQL: SELECT `rockfinder`.* FROM /* original pw query */ (SELECT pages.id FROM `pages` JOIN field_ska_status AS field_ska_status ON field_ska_status.pages_id=pages.id AND (((field_ska_status.data='FOR_SALE' ) )) LEFT JOIN field_ska_city AS field_ska_city__blank3 ON field_ska_city__blank3.pages_id=pages.id LEFT JOIN field_ska_city AS _sort_ska_City ON _sort_ska_City.pages_id=pages.id WHERE (pages.templates_id=49) AND (pages.status<1024) AND (((field_ska_city__blank3.pages_id IS NOT NULL AND (field_ska_city__blank3.data!='' OR field_ska_city__blank3.data='0')))) GROUP BY pages.id ORDER BY _sort_ska_City.data ) as `pwfinder` /* rockfinder */ LEFT JOIN ( SELECT `pages`.`id` AS `id`, `ska_City`.`ska_City` AS `ska_City` FROM `pages` /* --- join ska_City --- */ LEFT JOIN (SELECT `pages_id` AS `pageid`, `ska_City`.`data` AS `ska_City` FROM `field_ska_City` AS `ska_City`) AS `ska_City` ON `ska_City`.`pageid` = `pages`.`id` /* --- end ska_City --- */ ) AS `rockfinder` ON `pwfinder`.`id` = `rockfinder`.`id` /* end rockfinder */ In the JOIN the field is field_ska_city, but in the last FROM the field is field_ska_City... Is that normal behavior? Is this a bug? The code I use: $finder = new \ProcessWire\RockFinder("template=panddetail,ska_Status='FOR_SALE',ska_City!='',sort=ska_City",['ska_City']); $sql = $finder->getSQL(); print_r($sql); $finder->sql = "SELECT ska_city AS city FROM ($sql) AS tmp GROUP BY city"; $ska_Cities = $finder->getValues('city'); print_r($ska_Cities);
  12. Serverversie: 5.6.41-log - MySQL Community Server (GPL) = LIVE Serverversie: 5.6.38 - MySQL Community Server (GPL) = DEVELOPMENT
  13. I've compared the $sql variables on the live server end the local server. They both are the same. SELECT `rockfinder`.* FROM /* original pw query */ (SELECT pages.id FROM `pages` JOIN field_ska_status AS field_ska_status ON field_ska_status.pages_id=pages.id AND (((field_ska_status.data='FOR_SALE' ) )) LEFT JOIN field_ska_city AS field_ska_city__blank3 ON field_ska_city__blank3.pages_id=pages.id LEFT JOIN field_ska_city AS _sort_ska_City ON _sort_ska_City.pages_id=pages.id WHERE (pages.templates_id=49) AND (pages.status<2048) AND (((field_ska_city__blank3.pages_id IS NOT NULL AND (field_ska_city__blank3.data!='' OR field_ska_city__blank3.data='0')))) GROUP BY pages.id ORDER BY _sort_ska_City.data ) as `pwfinder` /* rockfinder */ LEFT JOIN ( SELECT `pages`.`id` AS `id`, `ska_City`.`ska_City` AS `ska_City` FROM `pages` /* --- join ska_City --- */ LEFT JOIN (SELECT `pages_id` AS `pageid`, `ska_City`.`data` AS `ska_City` FROM `field_ska_City` AS `ska_City`) AS `ska_City` ON `ska_City`.`pageid` = `pages`.`id` /* --- end ska_City --- */ ) AS `rockfinder` ON `pwfinder`.`id` = `rockfinder`.`id` /* end rockfinder */ SELECT `rockfinder`.* FROM /* original pw query */ (SELECT pages.id FROM `pages` JOIN field_ska_status AS field_ska_status ON field_ska_status.pages_id=pages.id AND (((field_ska_status.data='FOR_SALE' ) )) LEFT JOIN field_ska_city AS field_ska_city__blank3 ON field_ska_city__blank3.pages_id=pages.id LEFT JOIN field_ska_city AS _sort_ska_City ON _sort_ska_City.pages_id=pages.id WHERE (pages.templates_id=49) AND (pages.status<2048) AND (((field_ska_city__blank3.pages_id IS NOT NULL AND (field_ska_city__blank3.data!='' OR field_ska_city__blank3.data='0')))) GROUP BY pages.id ORDER BY _sort_ska_City.data ) as `pwfinder` /* rockfinder */ LEFT JOIN ( SELECT `pages`.`id` AS `id`, `ska_City`.`ska_City` AS `ska_City` FROM `pages` /* --- join ska_City --- */ LEFT JOIN (SELECT `pages_id` AS `pageid`, `ska_City`.`data` AS `ska_City` FROM `field_ska_City` AS `ska_City`) AS `ska_City` ON `ska_City`.`pageid` = `pages`.`id` /* --- end ska_City --- */ ) AS `rockfinder` ON `pwfinder`.`id` = `rockfinder`.`id` /* end rockfinder */ But $ska_Cities array remains empty on live server. Yet a copy of site on development server $ska_Cities is print_r: Array ( [0] => Array ( [city] => Aalst ) [1] => Array ( [city] => Duinbergen ) [2] => Array ( [city] => Heist-aan-Zee ) [3] => Array ( [city] => Knokke-Heist ) [4] => Array ( [city] => Oostende ) [5] => Array ( [city] => Varsenare ) [6] => Array ( [city] => Wenduine ) [7] => Array ( [city] => Zeebrugge ) [8] => Array ( [city] => Zwevegem ) ) ps: NO errors
  14. I have a problem getting to use Rockfinder online correctly. On my developer network every works fine, but once the site is online, RockFinder stops working. $finder = new \ProcessWire\RockFinder("template=panddetail,ska_Status='FOR_SALE',limit=0,ska_City!='',sort=ska_City",['ska_City', 'ska_ZipCode']); $sql = $finder->getSQL(); $finder->sql = "SELECT ska_City AS city, ska_ZipCode AS zip FROM ($sql) AS tmp GROUP BY city"; $ska_Cities = $finder->getArrays(); print_r($ska_Cities); I don't understand why... I also used new Rockfinder (without namespaces etc) I checked PHP version too... Is there some specific dependency that Apache or PHP should have for RockFinder?
  15. Great module! It is everything I needed for "group by" queries.
  16. Given the client situation I think it's best to inform them to be careful with the categories (for now)... And maybe later I will go for the hook option (it would be my first hook actually - no more escapism ? ). IMHO: I think that this should be some core logic not to be able to delete pages that are referenced by other pages via the PageField. Or at least get a notice that there are still references to it. It feels odd to me like this.
  17. Maybe I should have specified that, but I mean in admin (not api). ? Now I can just click on trash on a category and even when still referenced it is trashed immediately. (I don't want that ? )
  18. Hi, I'm having projects pages and categories pages. Each project has a PageField that references to one or more category/ies. How can I prevent that a category is deleted/trashed when a project still references it? Thx.
  19. Hello Forum, Yet another question. I'm importing data from an old database structure into Processwire. But when I import following data into a textarea (the standard Body one) then I get a lot of <p>&nbsp;</p> for some odd reason. Someone has a clue? I have used several approaches. // this $text = nl2br($r['textEN']); // but also this $text = $sanitizer->textarea($r['textEN'],array('multiLine'=>false,'newlineReplacement'=>'<br>','stripTags'=>false)); // // no difference The data from a text field in mysql: <table border="1" cellspacing="0" cellpadding="0"> <tbody><tr> <td width="403"><p><strong><em>Results</em></strong></p></td> <td width="95"><p align="right"><strong>30.06.2017</strong></p></td> <td width="96"><p align="right"><strong>30.06.2016</strong></p></td> </tr> <tr> <td><p>Operating result</p></td> <td><p align="right">11,402</p></td> <td width="96"><p align="right">10,163</p></td> </tr> <tr> <td><p>Net result of the year</p></td> <td><p align="right">3,853</p></td> <td width="96"><p align="right">2,688</p></td> </tr> <tr> <td><p>Share of the group in the net result of the year</p></td> <td><p align="right">3,888</p></td> <td width="96"><p align="right">2,689</p></td> </tr> <tr> <td><p><strong><em>Balance sheet</em></strong></p></td> <td><p align="right"><strong>30.06.2017</strong></p></td> <td width="96"><p align="right"><strong>31.12.2016</strong></p></td> </tr> <tr> <td><p>Total assets</p></td> <td><p align="right">641,120</p></td> <td width="96"><p align="right">605,547</p></td> </tr> <tr> <td><p>Cash and cash equivalents</p></td> <td><p align="right">17,263</p></td> <td width="96"><p align="right">15,273</p></td> </tr> <tr> <td><p>Net financial debt (-)</p></td> <td><p align="right">360,423</p></td> <td width="96"><p align="right">341,263</p></td> </tr> <tr> <td><p>Total equity</p></td> <td><p align="right">214,257</p></td> <td width="96"><p align="right">210,408</p></td> </tr> </tbody></table> The result in the textarea Body (source view): <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <table border="1" cellpadding="0" cellspacing="0"> <tbody> <tr> <td> <p><strong><em>Results</em></strong></p> </td> <td> <p><strong>30.06.2017</strong></p> </td> <td> <p><strong>30.06.2016</strong></p> </td> </tr> <tr> <td> <p>Operating result</p> </td> <td> <p>11,402</p> </td> <td> <p>10,163</p> </td> </tr> <tr> <td> <p>Net result of the year</p> </td> <td> <p>3,853</p> </td> <td> <p>2,688</p> </td> </tr> <tr> <td> <p>Share of the group in the net result of the year</p> </td> <td> <p>3,888</p> </td> <td> <p>2,689</p> </td> </tr> <tr> <td> <p><strong><em>Balance sheet</em></strong></p> </td> <td> <p><strong>30.06.2017</strong></p> </td> <td> <p><strong>31.12.2016</strong></p> </td> </tr> <tr> <td> <p>Total assets</p> </td> <td> <p>641,120</p> </td> <td> <p>605,547</p> </td> </tr> <tr> <td> <p>Cash and cash equivalents</p> </td> <td> <p>17,263</p> </td> <td> <p>15,273</p> </td> </tr> <tr> <td> <p>Net financial debt (-)</p> </td> <td> <p>360,423</p> </td> <td> <p>341,263</p> </td> </tr> <tr> <td> <p>Total equity</p> </td> <td> <p>214,257</p> </td> <td> <p>210,408</p> </td> </tr> </tbody> </table> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> PS: sorry for the long markup/post... ?
  20. Hello forum, I'm working with multilanguage websites most of the times, so when I create a field it is mostly multilangual. But for a specific project I need to have 1 template with a title (built-in PageTitleLanguage) with only one language. Is that possible? Thx, Karl
×
×
  • Create New...