Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

lickny2001's Achievements

Jr. Member

Jr. Member (3/6)



  1. i’m using a page reference field (single page) in a dropdown select in my simpleContactForm. in the email I’m sending, the selected page is referenced by its ID … how can i email page->title instead? i tried two routes: 1. simpleContactForm populates option values with page id’s, if i could replace these with page names; that would be a step in the right direction … but i don’t know how to accomplish this. 2. (preferred) the email I’m sending, outputs: %scf_select_event%, being the pageID … how can i change this to scf_select_event->title hopefully someone can point me in the right direction many thanks
  2. Im having trouble with this … i hope there’s someone out there to help. I have a bunch of pages with a multi-image (ImagesExtra module) field. My aim is to show all images from all pages in random order, accompanied with the title of the page they are on … I’m stuck on getting the page title after i’ve shuffled the array; I’m getting one and the same page title. thank you! $thumbs = new WireArray(); // get pages by template $posts = $pages->find('template=post_work’); foreach($posts as $post) { // get images, add to array foreach($post->images_extra as $thumb) $thumbs->add($thumb); } // shuffle array $random_thumbs = $thumbs->shuffle(); foreach($random_thumbs as $r) { echo "<img src='{$r->url}'> <p>$post->title</p>"; }
  3. i can't get this to work ... im trying to add an item in the center of my pagearray. // create new variable, shuffle array $imgShuffle = $folio->shuffle(); // count array items, divide by two to get logo position on grid $count = $imgShuffle->count(); // where to put the logo? $logoPosition = $imgShuffle->count() / 2; // round position $logoPositionRound = round($logoPosition); // target replaceimage $replaceImage = $imgShuffle->eq($logoPositionRound); // get replacing image (logo center) $logoCenter = $pages->get('/folio/amsterdam/')->child(); // replace images $imgShuffle->replace($replaceImage, $logoCenter); what am i missing? thank you!
  4. thank you all, we decided to go for an automated page creation through a json import script. a dear friend helped me with this. perhaps some one in the future stumbles across this topic and finds this helpful, below the import script <?php $TEMPLATE_COUNTRY = "country"; $TEMPLATE_REGION = "region"; $TEMPLATE_SUPPLIER = "supplier"; $TEMPLATE_WINE = "wine"; $rootid = wire('pages')->get('title=wines')->id; // All Wines: $file = "./lijst.json"; $raw = file_get_contents($file); // clean: replaces newlines in strings with \n and some other $raw2 = preg_replace('/\n(\w*)([^ \t\]\[{}"])/', '\\n$1$2', $raw); $data = json_decode($raw2, TRUE); $wines = $data['data']; // trash country pages + children before import $pages = wire('pages')->find('template=' . $TEMPLATE_COUNTRY); foreach($pages as $p) { $p->trash(); } foreach($wines as $wine) { // do the country pages $country = $wine['country']; // create new page is not exists $country_pages = wire('pages')->find('title="' . $country . '"'); if ($country_pages->count == 0) { $country_page = new Page(); $country_page->template = $TEMPLATE_COUNTRY; $country_page->title = $country; $country_page->parent = $rootid; $country_page->country_text = $wine["country_text"]; $country_page->save(); } // update exsiting else { $country_page = $country_pages[0]; } // do region pages $region = $wine['region']; if (!$region) { $region = "Other"; } $region_pages = wire('pages')->find('title="' . $region . '"'); if ($region_pages->count == 0) { $region_page = new Page(); $region_page->template = $TEMPLATE_REGION; $region_page->parent = $country_page->id; $region_page->title = $region; $region_page->region_text = $wine['region_text']; $region_page->save(); } else { $region_page = $region_pages[0]; } // do supplier pages $supplier = $wine['supplier']; // outlyer: wine without region ... should fix in source json if (!$supplier) { $supplier = "Other"; } $supplier_pages = wire('pages')->find('title="' . $supplier.'", parent='.$region_page->id); if ($supplier_pages->count == 0) { $supplier_page = new Page(); $supplier_page->template = $TEMPLATE_SUPPLIER; $supplier_page->parent = $region_page->id; $supplier_page->title = $supplier; $supplier_page->supplier_text = $wine['supplier_description']; $supplier_page->save(); } else { $supplier_page = $supplier_pages[0]; } // do wine pages $wine_page = new Page(); $wine_page->template = $TEMPLATE_WINE; $wine_page->parent = $supplier_page->id; $wine_page->title = $wine['wine']; $wine_page->wine_text = $wine['wijnomschrijving']; // same wine ... multiple years $year = $wine['year']; if (!$year) { $year = ''; } $wine_page->year = $year; // add 00s after comma if not there $price = preg_replace('/\.[0-9]$/', '${0}0', ''.$wine['price']); $price = preg_replace('/^[0-9]+$/', '${0}.00', ''.$price); $wine_page->prijs = $price; $wine_page->save(); } ?> curious to hear if any one wants to improve/comment on this thanks again!
  5. thanks for your responses, it will just be a wine list, no shopping involved
  6. dear processwire! i’ve been on this channel for a while, this is my first reach out for help. i have created simple pw driven sites from the ground up, now i have taken on a challenge that involves an existing (wine) dbase … and it freaks me out! here goes: by design, wines are presented like so: country - region - - supplier - - - wine | color | year | info | etc we have +/-: 10 countries, 60 regions, 150 suppliers, 600 wines our data is connected to a system the company also uses for stock, pricing, invoicing, etc. for now i have managed to import the dbase via CSVImport. to get the page structure that a want & understand (above) i first created - via CSV import - the country pages, then the region pages, supplier, and wine … i manually! (batcher module) changed the parent pages of each group of pages. now that this is done, i want to learn how to do it smarter. this is also necessary as we will need automatic updates when the source data changes. wines may come and go, prices change, etc. the CSV file i have lists all the wine data per row (country, region, supplier, etc), i can also get a json file, or json api calls directly to the data. i would appreciate help / pointers on a number of questions: 1. how to automate data synchronisation between system source & web data? or should we just make calls to the source? how does that impact performance, SEO? frankly if we take this route, I’m not sure i can build it, but i would like to … 2. i tried importing all wines (CSV import) with country, region, supplier as page fields related to (hidden) pages in a separate branch. this seems to work fine, however: a. I’m not comfortable with pages selecting based on 3 dynamic page fields b. one big branch with 600 wine records makes individual items difficult to manage 3. so the way i see it, i would like to automate synchronisation of data (cron or manual when data has updated). then i would need import script(s) to create,edit,delete pages based on the CSV or json data? how to do this? your thoughts, help are very much appreciated. i understand that I’m asking many questions in one and believe me, i have read most of the posts / topics on each individual question on the forum. regarding my last point 3. if theres any one out there who wants to take on this task, perhaps we can negotiate a price for your help/work, but i would also like to learn myself. thanks again!
  • Create New...