22 5 / 2012
Days In the Park
Days in the Park is a mash-up website which creates a daily timeline of videos, pictures and news pieces about New York’s Central Park.
Through the display of a variety of events, people and weather conditions, the site aims to communicate the dynamic atmosphere of this world reknowned park.
Users are able to select a date and enter a number of days to be displayed. The site will then display a timeline for the number of defined previous days*. Initially, the displayed content begins from the current day (in New York) for a period of 30 days. Videos, pictures and news are chosen randomly and refreshing the page may change the shown content.
Clicking on one of the thumbnails, takes the user to page for that day. There, the thumbnail’s item is enlarged. Images can be easily viewed, videos can be watched and news can be read (however, only part of the news item is available). The user is also able to access the original resource from this page. Below the main item, is a series of additional photos from the selected day. The user can click on any of these, to see these enlarged and a new set of photos for the day displayed underneath.
*Usually, the New York Times API is only a beta version and sometimes throws funny (and random) errors I can’t seem to pick up or handle! :(
URL
http://moniquealvis.com.au/daysinthepark/
For optimal viewing please use Google Chrome (or Firefox), as some functionality/styles are not supported by certain versions of IE.
Technical Information
The site aggregates photos from Flickr, videos from Youtube and news from The New York Times. Using these services’ APIs, Days in the Park uses PHP to make query the search functionality of these sites and return relevant data in XML of JSON format. This data is then manipulated to display the content.
Due to the complex layout of Days in the Park, a combination of PHP and Javascript has been used to achieve this display. You can view the backend code here.
Unfortunately, being entirely reliant on the data provided by these other services, some of the displayed content may be inaccurate and content may not be found for certain days, particularly dates which were a while ago. Please also allow some time for the page to load (I’m pretty sure this is because I bought hosting with a slow-ish server).
Reflection
Overall, I am very pleased with how Days in the Park has turned out and proud that I was able to achieve all that I had proposed.
Initially, I decided not to use Yahoo Pipes, as I believed it would be useful and challenging to query the APIs myself. And it was! I have learnt a fair bit about PHP and APIs as I have previously not used either of them before. I can definitely see how I may be able to use them in the creation of other sites in the future. If I were to re-do this site, I would probably develop more of it in Javascript and possibly utilise JQuery plug-ins.
21 5 / 2012
Image 1: Default timeline from current date
Image 2: Photos are displayed in full and can be clicked through to
Image 3: Videos can be played on the site
Image 4: Old content can sometimes be found!
13 5 / 2012
New Layout Design
I’ve found that my original wireframe layout does not allow for me to create thumbs which can include links, due the use of the absolute element and overlapping. Instead, I have decided to try a column approach.
This will allow to create the same visual aesthetic.
The basic div layout of one side of the timeline for this is:
<leftDivContainer>
<leftLineContainer><leftThumbLine1 />
<leftThumbLine2 />
<leftThumbLine3 />
<leftThumbLine4 />
</leftLineContainer>
<leftColumn1>
<leftThumb1 />
<leftThumb3 />
</leftColumn1>
<leftThumb2 />
<leftThumb4 />
<leftColumn2>
</leftColumn2>
</leftDivContainer>
(Sorry, I can’t indent on Tumblr)
The leftLineContainer is positioned absolutely and behind the divs, with a different z index. It holds the horizontal lines that connect to the main line.
Re-doing CSS
CSS styling and appropriate spacing is very important here and since my original layout had a few issues with it’s display as the page went down. (One side was longer than the other and therefore dates did not line up exactly) I have decided to perfect this. It felt like I was in grade 8 maths again, working out the missing lengths!

Hover Functionality
In addition, I’ve implemented hover functionality, so that when a thumb is hovered over, the date is displayed.
12 5 / 2012
Date Changing Functionality
At the moment, I have implemented a current day function, which retrieves the current day, month and year to determine what day should be specified in the API request calls.
However, part of my proposed idea was to allow users to skip to a date they want. Remembering back to another unit I had previously completed, HTML form functionality, using the get method, should allow me to achieve this. Trying this out with a simple textbox, I refreshed the day to return index.php?day=02&month=05&year=2012 Using a get method within my PHP code, I could then use these values to determine the start date to return output for.
I have later changed this output method to a more user-friendly select (drop down) form elements and implemented javascript verification to ensure that the dates chosen as valid. (Including checking for leap years!)
Timeline Dates
Similarly, I have improved my dateson the timeline itself, ensuring that the last day returned for the month is correct (eg. 31 for January, 30 for November)
08 5 / 2012
Integrating with The New York Times and YouTube
New York Times
Output from the New York Times API is only available in JSON format. Something I had not previously encountered and slightly different to XML, meaning I couldn’t simply copy my Flickr code.
The NYT API Request Tool was very helpful in generating a request and after some Googling, trial and error with code, I managed to get the outputs I was after!
Integrating the output with my site was much easier this time, as only a small bit of the code needed to be changed and I simply called a function to insert a news article (while the other called a function to insert an image).
The NYT API is only a beta release and I found that it occasionally threw funny errors that I haven’t been able to work out and therefore unable to catch and handle. Hopefully in future releases of it, this won’t happen! The warning messages for these have been suppressed, but at times they stop the rest of the page from loading. I’m not sure what I can do about this…
Youtube
YouTube’s request results were generated in XML format, although a little more complex than the Flickr results and I wasn’t sure how to access the tag I wanted, as a few had the same id. A little bit of Googling allowed me to access the tags I was after. Integrating again was a piece of cake!
Random Generation
I realised that I needed a function to randomly generate a number, so that the boxes would be randomly populated. PHP’s built in random number generator proved useful here. I used it, along with dividing the number by 3 or 5 to check determine which output was to be generated. I wanted my timeline to be primarily filled with pictures as they were the most accurate, likely and to be least filled with videos as the methods for searching youtube meant that inaccurate results were more likely than the other two. Overall, the random generation code was:
$randomNumber = rand();
if ($randomNumber%3 == 0) {
insertNews($day, $month, $year);
} elseif ($randomNumber%5 == 0) {
insertVideo($day, $month, $year);
} else {
insertImage($day, $month, $year);
};
Dealing with no data
Unfortunately, it was unavoidable that at times, no output could be found (particularly for older dates). For each of the insertion functions, if nothing could be found, they were directed to another, however, if nothing could be found at all, then a message saying this is displayed.
06 5 / 2012
Integrating with the Flickr API
Linking my page to the Flickr API is my first (and possibly hardest) milestone. Once I get this one perfect, I think it will be much easier to get the Youtube and News APIs in there!
I’ve gone with PHP with this. Not entirely sure why.. maybe because I once did an assignment with Javascript and didn’t really like it..
I’m going to incrementally update this post as I go…
Initial Output
So far, I’ve managed to get the output to work! I’ve used a loop which makes calls to the API and within each iteration changes the decrements the day. I will eventually need to work on changing months, but that’s for later.
Output within different divs
I’m not working on outputting the pictures to the different div boxes I’ve created. I’m working on a test page and what I’m getting the code to do is within a loop, output a different box depending on a count value. For example, if count = 4, the code will echo <div class=box4>. There are 8 different boxes and when the counter reaches 8, it changes back to 1. It’s working a treat and now to get it to work with my actual page, which is going to prove quite tricky as the boxes are to be nested within different div containers.
while (condition)if number = 1append content to leftTopDivnumber++elseif number = 2append content to leftBottomDivnumber++etc….
echo “<script type=’text/javascript’>$(‘#leftTopDiv’).append(“echo “$content”echo “’)</script>”;
And! After quite a bit of fiddling… It works!
There’s a bit of layout issues, but I plan on getting to this later…
02 5 / 2012
Uh oh! Using PHP to set up a loop I need to make to regenerate by little boxes. Something’s not quite right yet!!
01 5 / 2012
Incremental Development
I believe that incrementally developing my mash-up website will ensure that I have a polished and working site by the due date. I plan to undertake the following tasks in this order:
- Develop basic layout of the site
- Integrate Twitter API
- Integrate Youtube API
- Integrate News API
- Links to original sources
- Change the date functionality
- Hover functionality
- Develop layout for individual day pages
- Change links to individual day pages
- Individual day pages - add main item
- Individual day pages - add sub items
05 4 / 2012
Possible Resources for Development
Timeline
A widget that allows you to create interactive timelines. I will probably not use this, but they have their source code freely available and I may examine it for some inspiration!
http://www.simile-widgets.org/timeline/
Yahoo Pipes
Allows for a mash-up from different resources. I could use this to filter resources…?
05 4 / 2012
Inspirational Sites
Phylotaxis
“Where science meets culture. The individual beads of the Phylotaxis represent an ever-changing zeitgeist of science news, populated automatically every few hours by a program that scours online news sources and blogs that focus on science.”
——
News on a Timeline
“The RSS data from various news sources such as Google News and Reuters is aggregated and then displayed on a Timeline widget. Uses the MIT Simile timeline.”
http://news.alexeysmirnov.name/
——
TimeTube
“Shows YouTube videos on an interactive timeline based on keywords you enter, e.g. Barack Obama or Chocolate Rain.”
http://www.dipity.com/mashups/timetube/
——
Facebook Timeline
Although not a mashup site, the general structure of Facebook timeline and how it is coded to generate a clean, but varied layout, could be a source of inspiration.
(Source: programmableweb.com)

