Jump to content

jds43

Members
  • Content Count

    58
  • Joined

  • Last visited

Community Reputation

10 Good

About jds43

  • Rank
    Full Member

Profile Information

  • Location
    Little Rock, AR

Recent Profile Visitors

2,260 profile views
  1. Thank you @Robin S Allow me to look further at this.
  2. Here's what I have so far, but I'm getting inconsistent results. // Sanitize user input $zipcode = (int) $input->get->zipcode; // Set url for API with sanitized zipcode $link = "https://webapi.test.com/WebAPI/api/v1/test/" . $zipcode; function url_get_contents ($Url) { if (!function_exists('curl_init')){ die('CURL is not installed!'); } $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('APIKey:************')); curl_setopt($ch, CURLOPT_URL, $Url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); curl_close($ch); return $output; } $jsondata = url_get_contents($link); $location = json_decode($jsondata, true); // Set value of the Nearest Location ID (returned via API based on zipcode input) to session variable named "nearest" $session->nearest = $location['NearestLocationID']; $nearest = $session->nearest; // Let's match the zipcode entered by the user to nearest_location_id field to return the appropriate page $nearest_page = $pages->get('nearest_location_id=[session.nearest]'); echo "<hr>"; if(isset($nearest)) { echo "<h1>$nearest</h1>"; echo "<h2>".$nearest_page->title."</h2>"; } else { echo "<h2>None Selected</h2>"; }
  3. Thanks @Robin S I've been trying to cobble resources together to make this work. Just not quite sure of how to convert the json data to a session variable yet.
  4. Hello, I need to find a way to store a json value returned via REST API and use as a session variable, or something of the like. The user is to input their zip code to provide the closest store location, which is an ID that is returned by a get request (this ID is associated with a page). So this closest store location would now be selected to provide unique information to the user.
  5. Hello, Does anyone have experience with migrating content from Django to Processwire? Or are there any suggestions for achieving this?
  6. $main = $promoted->next(); echo "<h5>$main->title</h5>"; This is more concise 👏🏼
  7. $main = ""; $promoted = ""; $promoted = $homepage->promote; $main = $pages->find('template=main')->remove($promoted); foreach($main as $ma) { echo "<h5>$ma->title</h5>"; } This appears to have worked 👍🏼
  8. Hello, I have a Page Reference by template radio button field to promote a certain page (only two options), but I'd like to target the page that isn't selected. This would be used dynamically throughout the site. Does anyone know how I could accomplish this? Would I use something like remove() or not()?
  9. This is good to know, but I'm not getting anything from the selector.
  10. I had to keep parent=1018 because I don't want to include staff-pages that aren't doctors. The $page selector below is drawing errors. $doctors = $pages->find('template=staff-page,locations=$page') This is working though. foreach($doctors as $doc) { foreach($doc->locations as $loc) { if($loc->title == $page->title) { echo "<h4>$doc->title</h4>"; echo "<h5>$loc->title</h5>"; } } }
  11. Hello, I'm trying to select doctor pages associated with locations. Within this doctor page I have multiple pages selector (which are location pages) because doctors can work at many. When viewing a single location page, I'd like to loop through those doctors at that location, which is this $page. How can I achieve this because mine isn't working? $doctors = $pages->find('template=staff-page,parent=1018,locations=$page'); foreach($doctors as $doc) { echo "<h4>$doc->title</h4>"; } I guess I answered my own question. Is this an acceptable way to achieve? foreach($doctors as $doc) { foreach($doc->locations as $loc) { if($loc->title == $page->title) { echo "<h4>$doc->title</h4>"; echo "<h5>$loc->title</h5>"; } } }
  12. Ah ha! That would make sense. Thanks @kongondo
  13. Hello, I'm wondering how to add the value of a field to a URL when submitting a form, while also processing the form with FormBuilder and storing the entry in the CMS. Is this even possible with the versions below? FB 0.2.5 | PW 2.7.2 Is there still a dedicated Form Builder forum here anymore?
×
×
  • Create New...