Jump to content

Morphosis

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Morphosis

  1. Hi all, Ive create a page reference select list in admin to show a small number of images from a child page. <?php $int = 1026; foreach ($pages->get($int)->gallery_images as $photo): ?> <?php //$thumb = $photo->size(480, 320); ?> <div class="col"> <a class="gallery-item" href="<?= $photo->url; ?>"> <img src="<?= $photo->url; ?>" class="img-fluid rounded" alt="<?= $photo->description; ?>"> </a> </div> <?php endforeach; ?> I also have a link to the page reference too. <a href="<?= $page->gallery_cta_source->url; ?>" class="button button-border button-dark button-rounded mt-4">View full gallery</a> The above works when I set the $int = 1026, However, I want to use '$page->gallery_cta_source' which is the page id as a string. I have tried converting it to a int and use it but getting error: 'Object of class ProcessWire\Page could not be converted to int in...' <?php $string = $page->gallery_cta_source; $int = intval($string); foreach ($pages->get($int)->gallery_images as $photo): ?> Any advice or better options then I'm all ears! Thanks in advance.
  2. Thank you wbmnfktr, Like this approach very much and you/re correct, its much more flexible. I'll post an update once I have it inplace. Just show your kind support and time has not gone to waste. Thank you again.
  3. OK. This has broken me a little. Lots going on with my family, so brain fog is kicking in ? I have a Events page with the performers a children. Events |- Performer Name |- Repeater (date, description) |- Repeater (date, description) |- Repeater (date, description) - Performer name |- Repeater (date, description) |- Repeater (date, description) I'm trying to show: March Repeater(date) - Performer name - Repeater(description) Repeater(date) - Performer name - Repeater(description) April Repeater(date) - Performer name - Repeater(description) Any help would be so welcomed. I have looked at this: But not getting anywhere. Thank you in advance. Cheers Mark
  4. Hello. Hope you can help. I created a repeater to populate and dropdown with in the admin so the client can add/edit product categories for their shop. It's all working as expected in Chrome but noticed when testing i'm echoing out $m->selectfromrepeater->repeaterProdCatName Safari is not outputting the category names like Chrome is. My brain is fried with this so I thought I would reach out. I'm guessing I may need to loop the selectfromrepeater and push the name? just odd that chromes is out putting them fine This is how i'm creating JSON feed: foreach ($activeProducts as $m) { $data[] = array( "id" => $m->id, "product_title" => $m->product_title, "product_description" => $m->product_description, "product_price" => $m->product_price, "product_orig_price" => $m->product_orig_price, "product_images" => array( "url" => $m->product_images->first()->url, ), "product_category_new" => $m->selectfromrepeater->repeaterProdCatName, "product_quantity" => $m->product_quantity, "product_active" => $m->product_active, ); echo $m->selectfromrepeater->repeaterProdCatName; // Testing purposes }; Then access it in the javascript like this: function getProducts() { showProducts(<?php echo wireEncodeJSON($data); ?>); } Any pointers would be greatly received :)
×
×
  • Create New...