Jump to content

Vertical timeline and json


maba
 Share

Recommended Posts

I have to create a "vertical" timeline made by photo posts, blog posts, gallery and other kinds of entries with the "load more" button at the bottom (to not refresh entire page). 
Press "load more" and see a new (old) month (February 2014, January 2014, December 2013 ans so on).
 
Probably I'll use Timeline plugin, from www.melonhtml5.com.
 
I would have a suggest about how achieve this. 
My json is like this (Timeline example):
 
var timeline_data = [
    {
        type:        'blog_post',
        date:        '2011-08-03',
        dateFormat:  'DD MMMM YYYY',
        title:       'Blog Post',
        width:       400,
        content:     '',
        image:       'xxxx.jpg',
        readmore:    'http://www.example.com'
    },
    {
        type:        'slider',
        date:        '2010-12-16',
        dateFormat:  'DD MMMM YYYY',
        width:       400,
        height:      200,
        images:      ['xxx.jpg', 'xxx.jpg'],
        speed:       5000
    }
];
I think that I should have a template that merge different pages in one array to create the json file (not all fields are homogeneous).
But.. what is the right way to manage "load more" feature in this case?
 
- use external json file (a template create it and save it in cache folder, like ModulesMananager does) 
- use Pages Web Service (calling the page that does the job every "load more") 
- other sort of pagination
- idea?
 
Thanks,
Marco
Link to comment
Share on other sites

I would create an AJAX service which returns the JSON you need for your timeline. This script is called by your timeline to load more data.

Within the script itself I would use $pages->find('whatever you need here'), iterate through the items and build the JSON in the format you need it (e.g. switch/case by entry type)

As far as I know PW I think there will be a possibility to paginate with $pages although I couldn't find anything in the documention. Perhaps you can try something like this: $pages->find('template=blog|photo|whatever, limit=10, offset=10')

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...