I have created a section in the cms titled “Venues”. Inside venues i’ve created a few children pages with some basic blueprints like title, email, phone etc.
In another section on my site I have a “live listings” section with children pages. What I would like is that when I create a new “live listing” or choose a current one. The venue and number field should be a multiselect from the “venues” section above.
So to make things clear, I want the venue / contact number and lat long to be a multiselect field that only allows me to choose from the children pages in “venues”.
So If i have a venue called “Bobs Comedy Store” inside Venues. I then want to create a live listing called “Sally Biggins @ Bobs Comedy Store” inside live-listings. When it comes to the venue and number fields. I want it to be a multiselect that once I select Bob’s Comedy Store the venue and number should come from the “Bobs Comedy Store” Entry.
Hopefully I’ve explained this well enough.
UPDATE:
I managed to use the following blueprint to pull the venue title into the live-listings venue field.
But the problem is that when I try to use this same format under the “contact number” field it only shows me the phone number in the dropdown, i’ve no way to distinguish which venue it belongs too
But why do you need the number in the live listing? You could just get the number of the venue in your template instead of repeating the information in the live listing.
Edit: but you can add additional information like this:
But to output this in the php, the field needs to be dynamic, in the picture ive selected vicar street but it could be any of 10 venues. So how do i make sure that whatever venue is clicked the php will be outputted correctly?
I can’t seem to be able to output using the above.
My current page is live. The children of live are all the live listing entries.
So I presumed it would need to be altered a little like this
<?php
$venue = $page->children()->venue(); // to get the actual listings venue (which is a select field)
$number = page('venues')->children()->find($venue)->number();
?>
or something along those lines? I think the select field is causing problems because I cant even access the venue() if I run this
Thanks for your help but It’s still not working. But I think I know why.
When we are declaring
$venue = $child->venue();
echo $venue
// When I echo $venue the result "venues/vicar-street' appears
// So I think because we are trying to pass this back into the children string it can't find it.
<?php $venuePage = page('venues')->children()->find($venue); ?>
//Because if I loop to find out the venues children pages titles I get "Vicar Street" without any of the url bits.
<?php foreach($page->children() as $child) : ?>
<?php foreach(page('venues')->children() as $venuePage) : ?>
<?php echo $venuePage->title(); ?>
<?php endforeach ?>
<?php endforeach ?>
Do you think I’m onto something? Ive spent 4-5 hours doing this now and its driving me insane lol.
Thanks for all your help so far.
It probably makes more sense to separate the contact data into separate fields. Makes it much more reliable to access in case the contact information is not always built in the same way.
Edit: How does the content of the contact field look in the text file?