Raymond Geerts

Members
  • Content count

    346
  • Joined

  • Last visited

  • Days Won

    4

Raymond Geerts last won the day on September 6 2016

Raymond Geerts had the most liked content!

Community Reputation

478 Excellent

About Raymond Geerts

  • Rank
    Sr. Member
  • Birthday 07/12/1975

Profile Information

  • Gender
    Male
  • Location
    The Netherlands

Recent Profile Visitors

6,492 profile views
  1. I solved the update issue as follow: - before touching the repeater matrix field, count the already existing (n) repeater matrix items. - add all the new (updated) repeater matrix items, including the repeater items inside the repeater matrix. - remove the first (n) repeater matrix items from the field.
  2. Still having some difficulties here when updating a repeater inside a repeater matrix. Somehow it is not possible to use the same code for adding a new page, and updating the same page with a repeater inside a repeater matrix, as shown in the below example. I do not seem to be able to update the page, and keep getting the following error message: Error: Exception: Can't save page 0: /1486742936-8959-4/: It has no parent assigned (in /Users/raymond/Dropbox/www_domains/testing123/htdocs/wire/core/PagesEditor.php line 464) The code to add a new page, and data to a repeater inside a repeater matrix. $urls = array( 'https://www.youtube.com/watch?v=e5gvzCOhBLQ', 'https://www.youtube.com/watch?v=rbhnkeh9liQ', 'https://www.youtube.com/watch?v=poRFOvxyOWI' ); /** * First run, adds new article page * */ $options = array( 'template' => 'article', 'parent' => $parent = $pages->get('template=articles'), 'title' => 'This is a test', 'date_pub_start' => time() ); $p = $pages->add( $options['template'], $options['parent'], $options ); $p->of(false); // repeater_matrix_content - type: intro $intro = $p->repeater_matrix_content->getNew(); $intro->repeater_matrix_type = 1; // intro $intro->intro = 'Lorem ipsum'; $p->save('repeater_matrix_content'); // repeater_matrix_content - type: text $text = $p->repeater_matrix_content->getNew(); $text->repeater_matrix_type = 2; // text $text->body = 'Lorem ipsum dolor sit amet'; $p->save('repeater_matrix_content'); $videos = $p->repeater_matrix_content->getNew(); $videos->repeater_matrix_type = 4; // videos $videos->save(); foreach($urls as $url) { if (empty($url)) continue; $repeater_video = $videos->repeater_videos->getNew(); $repeater_video->link_url = $url; $videos->save('repeater_videos'); } $p->save('repeater_matrix_content'); The code to update the just added page. (not working). Note that the code for adding the repeater matrix items are identical to the above code. The first two items of the type (1=intro, 2=text) are succesfully added and saved. The problem occurs when trying to add repeater items to the repeater matrix type 3=video. What am i doing wrong? $options = array( 'template' => 'article', 'parent' => $parent = $pages->get('template=articles'), 'title' => 'This is a test', 'date_pub_start' => time() ); /** * Second run, updates existing article page * */ $id = $p->id; unset($p); $p = $pages->get($id); $p->of(false); $p->title = $options['title']; $p->date_pub_start = time(); $p->save(); foreach($p->repeater_matrix_content as $rp) { $pages->delete($rp, true); } // repeater_matrix_content - type: intro $intro = $p->repeater_matrix_content->getNew(); $intro->repeater_matrix_type = 1; // intro $intro->intro = 'Lorem ipsum'; $p->save('repeater_matrix_content'); // repeater_matrix_content - type: text $text = $p->repeater_matrix_content->getNew(); $text->repeater_matrix_type = 2; // text $text->body = 'Lorem ipsum dolor sit amet'; $p->save('repeater_matrix_content'); $videos = $p->repeater_matrix_content->getNew(); $videos->repeater_matrix_type = 4; // videos $videos->save(); foreach($urls as $url) { if (empty($url)) continue; $repeater_video = $videos->repeater_videos->getNew(); $repeater_video->link_url = $url; $videos->save('repeater_videos'); } $p->save('repeater_matrix_content');
  3. Thanks @BitPoet it works very well. I removed the ->add from all my code and all other repeater matrix items are still 'added' just fine by getNew().
  4. Can any one point me in the right direction / or give a working example how to add repeater items to a repeater field inside a repeater matrix field. I tried many different approaches, reading many topics on the forum, but can not get it working. The following example gives an error about not being able to add page with ID 0 $rpm = $page->repeater_matrix_content->getNew(); $prm->repeater_matrix_type = 1; $prm->save(); $prm->of(false); foreach($videos as $video) { if (empty($video['url'])) continue; $rp = $prm->repeater_videos->getNew(); $rp->save(); $rp->link_url = $video['url']; $rp->save(); $prm->repeater_videos->add($rp); } $prm->save(); $page->repeater_matrix_content->add($prm);
  5. Thanks Robin S for posting a working example. I will give it a try.
  6. Perhaps that can be solved by 'faking' the PageArray as shown by LostKobrKai $pa = new PageArray(); $pa->setTotal($total)->setLimit($limit)->setStart($start); $pager = $this->modules->get('MarkupPagerNav'); $pagination = $pager->render($pa);
  7. This example works by adding (prepending) an item to the list. What i'm looking for is a way to manipulate the `start` value and wonder if the following might do the trick. <?php $limit = 10; $limit_first = 8; $offset = $limit_first - $limit; if ($input->pageNum == 1){ $products = $pages->find("template=product, sort=-date_pub, start=0, limit=$limit_first"); } else { $start = (($input->pageNum - 1) * $limit) + $offset; $products = $pages->find("template=product, sort=-date_pub, start=$start, limit=$limit"); }
  8. I was wondering how to achieve the following. A total of 100 pages which are listed with a limit of 10 items per page, resulting in 10 pages of 10 items. Instead i desire the following (below), and wondering how to setup the code / selector(s). The first page should show a list of 8 items. After that all following pages should have a limit of 10 items. page 1 -> items 1 - 8 -> (limit 8) page 2 -> items 9 - 18 -> (limit 10) page 3 -> items 19 - 28 -> (limit 10) ... page 9 -> items 79 - 88 -> (limit 10) page 10 -> items 89 - 98 -> (limit 10) page 11 -> items 98 - 100 -> (limit 10) The ideal situation would be to have an extra page selector property aside of 'limit', something named 'limit_first' or alike.
  9. Trekkerweb Supply & Demand https://markt.trekkerweb.nl/ Trekkerweb.nl brings agricultural mechanization news and supply & demand together in a single online platform for all the tractor and machine enthusiasts and others interested in the mechanization sector. The site is multi-language with English as default. None Dutch browsers will get the English version of the site, currently we are finetuning the German version which will be available somewhere in the near future. The search page in English and Dutch language - https://markt.trekkerweb.nl/search/ - https://markt.trekkerweb.nl/nl/zoeken/ Used modules Profields Table Profields Textareas MarkupLoadRSS (fetches brand related new from the main website) PageImageManipulator 2 (PIM2) (for placing watermark image) ProCache ProcessGetVideoThumbs TextformatterVideoEmbed WireMailSmtp LanguageSupport (Site is multi language: Dutch, German and Default English) Couple of custom made modules for user profiles and cross page linkage of the datamodel (Bower) components awesome-bootstrap-checkbox bootstrap-dropdowns-enhancement-sass bootstrap-sass bootstrap-select font-awesome formvalidation.io hashids jquery jquery-file-upload jquery-throttle-debounce jquery.mmenu js-cookie lifestampjs moment semantic-ui-sass verge Front-end user profiles (custom module) Account registration Customizable fields (in module settings) Per field privacy configurable (private, public, on a per user basis). Front-end login/ logout Reset password Email activation for account Request activation mail View profile Public profile Edit profile Set profile picture (cover image and avatar) Modify password Language choice Profile dashboard Front-end Ads management Create new ad Edit existing ad Manage media (images / video) Preview and approve ad Remove ad Data model Categories Subcategories Brands Input fields Options An intuitive data model drives the whole site. A couple custom made modules take care of the cross page assigning of categories to subcategories and brands. Per subcategory we are able to assign the related input fields and options which will be rendered on the 'Create new ad/ Edit ad' form page and combined with the given values rendered on the ad detail page. Database caching + Pro caching One of the challenges was to keep the whole project as low weight as possible. Since the data model with categories, subcategories, brands, inputfields and options is the backbone of the site we came up with the solution to have the names, titles, ids, and relations between them cached. Completely as json/javascript with pro cache and separated with database caching. With the Wire Fuel we made the $dm object available for accessing anywhere in PHP and globalJS.dm from within javascript. This means the whole data model is called only once per request, and while it exists in the database cache and pro-cache it is incredibly fast. Subcategory page The first image shown below represent one of the subcategories (Tractors) with assigned categories, brands, input fields and options. The image there after is a screenshot of the add ad page, where the input fields, options and brands are dynamicly rendered after being loaded via Ajax. Other features cookie based favourites cookie based last-viewed list advanced filter search related ads Thanks to the whole team (Ferdi, Bastiaan, Alex, John, Hessel) and last but not least Ryan for creating ProcessWire and all module developers out there
  10. This seems to be a great Lorem Ipsum type of module AutoContent generator by adrian https://processwire.com/talk/topic/11016-autocontent-generator/
  11. I must admit i dont know that much about encryption myself, so I have used the following example with a little modification. http://stackoverflow.com/questions/16600708/how-do-you-encrypt-and-decrypt-a-php-string/16606352#16606352 Do not use BLOWFISH and EBC (this it too predictable) as in the example, instead of that i'm using RIJNDAEL_128 (or 256 if you like) and CBC I also recommend to use a long encryption key, maybe something above 1024 characters, or even 2048 long function encrypt($pure_string, $encryption_key) { $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $encrypted_string = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $encryption_key, utf8_encode($pure_string), MCRYPT_MODE_CBC, $iv); return strtr(base64_encode($iv.$encrypted_string), '+/=', '-_.'); } function decrypt($encrypted_string, $encryption_key) { $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $encrypted_string_dec = base64_decode(strtr($encrypted_string, '-_.', '+/=')); $iv_dec = substr($encrypted_string_dec, 0, $iv_size); $decrypted_string = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $encryption_key, substr($encrypted_string_dec, $iv_size), MCRYPT_MODE_CBC, $iv_dec); return trim(utf8_decode($decrypted_string)); } update: The base64 encode/decode i threw in so that it should be possible to use the encrypted strings as url segments and so are able to use it together with procache
  12. Bitnami XAMPP has ProcessWire available as all-in-one add-on on top of XAMPP. https://bitnami.com/stack/xampp#processwire https://www.apachefriends.org/add-ons.html
  13. HomeProductsProduct1Review-Product1 Product2Review-Product2 Product3Review-Product3 Contact --- The parent from "Review-Product1" is "Product1" The rootParent from "Review-Product1" is "Products"
  14. Note: $tmpDir = wireTempDir('someName'); Should be: $tmpDir = new WireTempDir('someName');
  15. @Horst thanks for the working example. Saves me from typing