About this json source - does it happen to be online? I'd like to take a look if it's possible.
I advise to also create a function that keeps track of last json fetch and does refresh json after a period of time (whenever admin or visitor or cron script visits the site). It can have a date check which compares 'today' with last fetched json modification date. Therefore it is a good idea to create a variable in a global template to store last fetch date or, instead, cache the json on disk with KK's cms:write tag and write a cms:func to get last modification date from the file on disk.
the events listing will be just that - a list of dates plus afew details. Converting the feed into cloned pages would be good because it'll then be possible to display UPCOMING and PREVIOUS events.
Listing upcoming or previous events doesn't require them be in cloned pages. A date comparison should be enough. However it won't hurt of course to have events in database - if client decides to show archives - how many events were held past November, for example.
how Couch will get hold of the .json feed of data
If I were tasked with such a feature, I would try use my function -
<cms:call 'remote_url' /> - see "Example 2. Show latest 5 commits for CouchCMS repo on GitHub" here
viewtopic.php?f=8&t=11368&start=10#p30228 That example is reading json response from GH and outputs part of it. Latest updated version is on my github
https://github.com/trendoman/utility-fu ... aster/curlAnd when a new date is added to the feed - how does that get picked up and added to the existing cloned pages of events.php?
Since we have gathered json from a previous step, now there must be a script which compares events from json to events already in database. Simplest way is to iterate over events from json and search each in database. I can not tell you exactly how to build iterator because I have not seen the exact json, but it will be with cms:each and using multi-value variables aka arrays Concept
viewtopic.php?f=5&t=10892. Add event in case it is not found by using <cms:no_results > -
- Code: Select all
<cms:set event_name = 'xyz' />
<cms:pages paginate='1' limit='1' page_name=event_name skip_custom_fields='1' show_future_entries='1' show_unpublished='1' >
<cms:no_results>
<!-- Here create cloned page with cms:db_persist -->
</cms:no_results>
</cms:pages>
If you can afford extra hands on this job, PM me and I'll gladly work on the script.