combicart Posted December 30, 2016 Share Posted December 30, 2016 Hello, I'm currently creating an Events website. I've setup an 'events' page with a date, start time and end time. I'm using the fields to print them out on the page. However, I would like to add the option that visitors can download an ICS file so that they can quickly add the event to their calendar. I've found https://github.com/markuspoerschke/iCal for the creation of het actual ICS files. I've created a new template file (download-ics) and used one of the examples (https://github.com/markuspoerschke/iCal/blob/master/examples/example7.php) for the template. When i'm browsing to the url with the (download-ics) template the ICS file is being downloaded correctly. However now there are only fixed values inside the ICS file. How can I pass the variables from the actual event into the newly created (download-ics) template file so that the actual date and times can be used? Link to comment Share on other sites More sharing options...
BitPoet Posted December 30, 2016 Share Posted December 30, 2016 You need to pass the page id of the event in question (probably as a GET parameter or URL segment) when you open the ICS page, then in your ICS template retrieve the corresponding page (remember to use sanitizer or (int) casting to make sure you're really getting a valid page id) and fill in the page's field values. 2 Link to comment Share on other sites More sharing options...
combicart Posted December 30, 2016 Author Share Posted December 30, 2016 Thanks BitPoet, will use this setup to fetch the page id. Also the sanitation is a good tip! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now