-
Posts
812 -
Joined
-
Last visited
Community Answers
-
a-ok's post in Count matching results within a repeater was marked as the answer
I worked it out as the following...
$repeater = $page->get('article_overview_flexible_layout'); $count = $repeater->find('article_overview_flexible_layout_type=4')->count();
-
a-ok's post in Getting the page title a repeater field is on from a pageField was marked as the answer
$pages->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments(0); $repeater = $page->collections_detail_images; foreach ($repeater as $row) { $row->of(false); $row->collections_detail_image_page_title = $page->title; $row->save(); } }); This is what worked.
-
a-ok's post in Field visibility conditions (only show if parent is...) was marked as the answer
I believe I have this working: https://processwire.com/talk/topic/9406-inputfield-dependencies-hide-field-by-path/?p=121319
-
a-ok's post in PHP Arrays to JSON without [] was marked as the answer
This is what I came up with... after much trial and error:
<?php $geojson = array( 'type' => 'FeatureCollection', 'features' => array() ); $programmes = $pages->find('parent=programme, sort=sort'); foreach ($programmes as $programme) { $marker = array( 'type' => 'Feature', 'properties' => array( 'title' => $programme->title, 'url' => $programme->url, 'summary' => $programme->programme_summary, 'image' => $programme->programme_venue_image->url ), 'geometry' => array( 'type' => 'Point', 'coordinates' => array( $programme->programme_location->lng, $programme->programme_location->lat ) ) ); array_push($geojson['features'], $marker); } $programme_json = json_encode($geojson); ?> -
a-ok's post in AJAX/PJAX local to remote issues was marked as the answer
Referencing https://github.com/defunkt/jquery-pjax/issues/66 I changed the timeout default using
$.pjax.defaults.timeout = 3000; And this seemed to have solved the issue.
-
a-ok's post in AJAX driven content and body classes was marked as the answer
Hi folks, thanks for all your replies. Here's how I did it.
$(document).on('pjax:end', function() { var bodyClass = $('meta[name=body-class]').attr('content'); if (bodyClass !== undefined) { document.body.className = bodyClass; } }); Then on every template which would be within the ajax/pjax container:
<meta name="body-class" content="<?php echo $page->name; ?>" /> Thanks,
R
-
a-ok's post in Check whether next/prev page or not was marked as the answer
Fixed this with
<?php if ($page->next->id) : ?> -
a-ok's post in Inputfield Dependencies OR operators was marked as the answer
Hi @LostKobrakai, thanks for the help.
The Pagefield, to work as I need to, needs be either 1062 OR 1063 to then show the email field. If it is blank, it simply won't show.
So, to generalise...
If Pagefield is empty, no email field.
If Pagefield = 1062 then show email field.
If Pagefield = 1063 then show email field.
So I guess this would work...
chair_vice!='' If the Pagefield (chair_vice) isn't empty, then show the email field... just tried it... yes this works!
And yep, tried second suggestion... no implementation yet Just upgraded too.