Having a lot of trouble setting up a view, I keep getting an "undefined variable" error:
Notice: Undefined variable: date in views_timelinejs_plugin_style_timelinejs->render() (line 343 of ...sites/all/modules/views_timelinejs/views/plugins/views_timelinejs_plugin_style_timelinejs.inc).
I had a lot these errors to begin with until I made sure that the FIELD MAPPINGS settings were complete. This particular error seems to relate to the date field but I can't seem to get things working no matter which date field I try to use.
When I look at the JSON preview on the views' edit page it looks like the correct date information is present. Here's the output
Array
(
[type] => timeline
[embed_path] => sites/all/libraries/timeline/compiled/
[id] => storyjs-mkdvrsxh
[embed_id] => timelinejs_timeline_page
[lang] => en
[width] => 100%
[height] => 500
[start_zoom_adjust] => 0
[start_at_slide] => 0
[start_at_end] =>
[source] => Array
(
[timeline] => Array
(
[headline] => Test Headline
[type] => default
[date] =>
[era] => Array
(
[0] => Array
(
[startDate] => 1352089871
[endDate] => 1352089871
[headline] => My new scenario
[text] =>
Magna velit aenean placerat vel velit! Phasellus tincidunt ultricies? Hac pellentesque tempor, et lorem enim, sed. Scelerisque et scelerisque, adipiscing quis habitasse tortor tristique nec duis! Habitasse aliquam, et auctor est elit, lundium magnis nec ac amet et enim porttitor risus vel ut facilisis. Pulvinar pellentesque. Ultrices pulvinar. Duis mauris sociis porta dapibus magna. Nunc placerat augue! Scelerisque dis porttitor, pellentesque mattis mus cras ac! Nisi, amet, mus sit aliquet, purus parturient vel montes sit in vel facilisis lundium aenean! Odio elementum augue!
[tag] => My new scenario
)
)
)
)
)
Am I missing something obvious?
Comments
Comment #1
juhaniemi commentedTimestamps (node created, updated dates) are currently broken, since we added support for date fields. It only works with date fields currently. We'll try to post a fix soon. Thanks for heads-up!
Comment #2
cossovich commentedOk, I've tried a date field instead but I still end up with the same error.
Does the date field need to be a certain field type? For example Date, Date (ISO format) or Date (Unix timestamp)
I've compared the TimelineJS JSON format with the views preview display and it's hard to tell if my fields aren't configured correctly or if the view isn't configured correctly. I think it would be an improvement if the view worked by without configuration by using sane defaults event if that meant that the initial timeline didn't display any data.
I've made a start on some updated documentation and a change to the views configuration form over here... #1834180: Update module documentation and interface language.
I would greatly appreciate any advice on how to configure the content fields and the view to get things working.
Comment #3
Aleksey Zubko commentedI finally got Timeline working after rollback was made.
Tried Date field, but only got a lot of error messages. So I've used a "Post date" field for date and it did the trick.
Comment #4
cossovich commented@Drucode, yeah I can confirm that too. I got it working with the Node created date.
From what I can gather looking at the plugin code the reason Date (Unix timestamp) doesn't work is because views' field configuration that field doesn't include any timezone options and the plugin uses format_date which requires an explicit timezone parameter (it doesn't go look up the sites' timezone setting).
I need this working for date fields over the next couple of days so I think my next efforts will be aimed improving the date handling in the plugin code.
Comment #5
operinko commentedThe current version should have improved time handling (and support for date field as well as the timestamps).
The system has been changed to only show the fields that we have ctools plugins for (that is, modular support).
Comment #6
cossovich commented@operinko Commit 0a6e09d on 7.x-1.x doesn't play nicely with date fields for me... Post date and Date (Unix timestamp) fields are displayed in the settings form but only post date works. If I choose a date field I get the following error:
Also, I don't know much about ctools plugins but I think there's a typo in the ctools date source plugin. The names of the helper functions in views_timelinejs.module (views_timelinejs_convert_to_gregorian, etc) were misspelled... I've attached a patch to illustrate.
Comment #7
operinko commentedThe commit you refer to was missing some of the intended functionality.
The latest commit should play nice with date fields and post dates.
Comment #8
cossovich commented@operinko nice one! I can confirm commit 16dce6f is working for me.
Comment #9
operinko commentedMarking this as fixed, if this issue still persists it can be opened again.