-
Posts
118 -
Joined
-
Last visited
Everything posted by KarlvonKarton
-
Trouble with _n('') and translation
KarlvonKarton replied to KarlvonKarton's topic in General Support
Aha! Got it ;-) -
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
-
How to get page title of other languages ?
KarlvonKarton replied to adrianmak's topic in Multi-Language Support
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>'; } -
How to use selectors include=hidden only with specific template?
KarlvonKarton replied to Hurme's topic in API & Templates
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? -
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!
-
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...
-
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)
-
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);
-
Serverversie: 5.6.41-log - MySQL Community Server (GPL) = LIVE Serverversie: 5.6.38 - MySQL Community Server (GPL) = DEVELOPMENT
-
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
-
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?
-
How to 'group by' a field in processwire?
KarlvonKarton replied to SIERRA's topic in General Support
Great module! It is everything I needed for "group by" queries. -
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.
-
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> </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> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </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> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> PS: sorry for the long markup/post... ?
-
Adding images with API gives errors
KarlvonKarton replied to KarlvonKarton's topic in General Support
Maybe it is not good practice to add a picture to a Processwire page from an external URL like that? -
Adding images with API gives errors
KarlvonKarton replied to KarlvonKarton's topic in General Support
Is there a way to prevent PW to crash on this error? -
Adding images with API gives errors
KarlvonKarton replied to KarlvonKarton's topic in General Support
Apart from the Processwire error: I also log errors when checking if the url of the picture is a real picture like this: if(getimagesize($picture['UrlXXL'])) Sometimes i get the error (not always the same pictures): [2] getimagesize(http://gobert.websites.whoman2.be//Pictures/2602849/1920/be61d9390d4b42bb8ec1e3e1c37055e3.jpg): failed to open stream: Operation timed out Is it safe to conclude that Dragan is right about the service having trouble? Or could there be yet another problem?