Forum
Event Module or custom_content for type="file"
I need to have 3 event sections over 2 pages (ie shared template) - list of future events on my home page and an events page with a section listing future events and section listing past events.
If I use the event module, I cant work out how to add attachments to my events (the doc attachment in the description file shows [cms:asset 109 title=”Spring Walk 2018”] rather than a link to my doc. https://www.cannizaropark.com/cannizaro-pages/events1.php (nb not formatted yet) I can add in an event type="file" into event.html - but its not showing in the admin panel when I add an event. I'm guessing this isnt the right way.
If I use a normal content template with multiple items (with content type ="file") this works fine for future events on both pages but I'm struggling to filter it using perch_custom_content (either on date, or on the "past" checkbox I have added to the template. I havent gone too far with this option, as I've read that you cant use shared templates with custom_content. If I can use shared templates with custom_content, and this is the right way, I will post my code in the hope that someone will spot what I have done wrong.
Hi,
Can you explain what you mean by "shared template" so we're on the same page?
You can use the same template with
perch_content_custom()
:And on other pages:
If you have a date field, you can filter events based on that without having to mark past events manually.
Hi thanks for looking at this By shared template I mean a template where I click "share across all pages" in the Region Options. But now i re-read the post I was trying to fix this with, I cant see that it is a problem so that probably isnt it (https://docs.grabaperch.com/templates/passing-variables-into-templates/)
I think my problem is that I'm not using the custom_content properly. I'm used to perch_blog_custom where I dont need to pass anything in so I'm really not sure what I should be passing in here.
My template is :
and the code I am using for my page is below (I've tried 3 different ways...!)
I've tried it 3 ways - none gives a result, even though I have past and future date events set up and ones with the Past Event clicked. I've also tried passing in 'Events' as you suggest, and that gives me nothing either.
The template works fine if I call it as perch_content (shows in orange section under Forthcoming events https://www.cannizaropark.com/cannizaro-pages/events.php).
Thanks so much
If you're using
perch_content_custom()
you don't need the region to be shared. Instead you can use thepage
option to target a region from a different page.It's like Drew stated; you don't need to use a shared region for this.
In your code you are using different region keys:
You want to query the same region. A region has only one key. So these all should be the same.
I think it would be helpful to you to go through these docs and tutorials:
perch_content_custom()
: https://docs.grabaperch.com/functions/content/perch-content-custom/#filtering-contentIn your template, you're also using both perch: content and perch:events... If you are working in the events app, the template needs to refer to that app space. All the tags should be perch:events tags.
Thank you for all your suggestions.
I am going to use the event app as that is working well for me for Event title, description and date. https://www.cannizaropark.com/cannizaro-pages/events1.php
However I would like to allow Perch users to add an attachment to the description (for event flyers).
The event description field has the option to attach a file, but as in my original post this adds [cms:asset 109 title=”Spring Walk 2018”] rather than a link to the attachment.
Therefore I would like to add a perch event id of type file to be entered with the rest of the event.
I have edited event.html to add the report field but when I add a new event in Perch Admin, the new fields do not show.
Presumably event.html is not the right template for entering event details? Can anyone help me let a user add a pdf file to the event when they enter the event details?
My Event.html code is below (nb I have commented out the image as I dont need this, but it still shows when I am in the Perch Admin adding a new event).
So if that's your template, your perch tags all need to be
perch:events
tags. So 2 errors above. Fix those and the items will appear in your admin. Should be:And I don't think the title tag will work here as the events app uses the date and the event title. You can only set title in the content app.
And, yes, in templates, perch will read in field definitions even if they are within comment tags. If you want to comment them out so perch ignores them too, see this page: https://docs.grabaperch.com/templates/comments/
Thanks so much. Its all working now