/ Published in: PHP
This is a snippet I did for a project-- it relies on Drupal and the Flickr module for Drupal.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<? $arg['per_page'] = 48; $arg['page'] = 1; $arg['tags'] = "E31"; // the default tag ?> <ul> <li><a href="?tags=H32">January 2007 - H32</a> <li><a href="?tags=J31">February 2007 - J31</a> <li><a href="?tags=N27">March 2007 - N27</a> <li><a href="?tags=G30">April 2007 - G30</a> <li><a href="?tags=H22">May 2007 - H22</a> <li><a href="?tags=M29">June 2007 - M29</a> <li><a href="?tags=H28">July 2007 - H28</a> <li><a href="?tags=H31">August 2007 - H31</a> <li><a href="?tags=N29">September 2007 - N29</a> <li><a href="?tags=L31">October 2007 - L31</a> <li><a href="?tags=N24">November 2007 - N24</a> <li><a href="?tags=M31">December 2007 - M31</a> <li><a href="?tags=Q28">January 2008 - Q28</a> <li><a href="?tags=H24">February 2008 - H24</a> <li><a href="?tags=E31">March 2008 - E31</a> </ul> <? if ($_GET['page']) { } $arg['tags'] = $_GET['tags']; drupal_set_title(t('Archives for '.$_GET['tags'])); } $response = false; $arg['group_id'] = "92284808@N00"; // Victoria Grid Project group $arg_hash = ''; $args = ''; $set_response = flickr_request('flickr.groups.pools.getPhotos', $arg); $output = ""; $photos['page'] = $set_response['photos']['page']; $photos['pages'] = $set_response['photos']['pages']; $photos['perpage'] = $set_response['photos']['perpage']; $photos['total'] = $set_response['photos']['total']; foreach ($set_response['photos']['photo'] as $result) { $x++; $item['taken'][$x] = FALSE; $item['id'][$x] = $result['id']; $item['owner'][$x] = $result['owner']; $item['secret'][$x] = $result['secret']; $item['server'][$x] = $result['server']; $item['farm'][$x] = $result['farm']; $item['title'][$x] = $result['title']; $item['ispublic'][$x] = $result['ispublic']; $item['isfriend'][$x] = $result['isfriend']; $item['isfamily'][$x] = $result['isfamily']; $item['ownername'][$x] = $result['ownername']; $item['dateadded'][$x] = $result['dateadded']; } $output .= '<table cellspacing="0" cellpadding="5" border="0">'; for ($y = 1; $y <= $x; $y++) { if ($item['taken'][$y] === FALSE) { $item['taken'][$y] = TRUE; if ((($y % 3) == 1) || ($y == 1)) { $output .= "<tr>"; } $output .= '<td valign="top" align="center"><a href="http://farm'.$item['farm'][$y].'.static.flickr.com/'.$item['server'][$y].'/'.$item['id'][$y].'_'.$item['secret'][$y].'_b.jpg" rel="lightbox" title="'.$item['title'][$y].' by '.$item['ownername'][$y].'"><img src="http://farm'.$item['farm'][$y].'.static.flickr.com/'.$item['server'][$y].'/'.$item['id'][$y].'_'.$item['secret'][$y].'_m.jpg" width="160" alt="'.$item['title'][$y].' by '.$item['ownername'][$y].'"></a><br/><a href="http://www.flickr.com/photos/'.$item['owner'][$y].'/'.$item['id'][$y].'/in/pool-victoriagridproject" >'.$item['title'][$y].' by '.$item['ownername'][$y].'</a></td>'; if ((($y % 3) == 0) || ($y == $x)) { $output .= "</tr>\n"; } $maketr = 1; } } $output .= "</table>"; $output .= "<center>"; for ($a = 1; $a <= $photos['pages']; $a++) { if ($a != $photos['page']) { $output .= '<a href="?page='.$a.'&tags='.$arg['tags'].'">'.$a."</a> "; } else { $output .= '<b>'.$a."</b> "; } } $output .= '<br/>'.((($photos['page'] - 1) * $photos['perpage']) + 1).' - '.($photos['page'] * $photos['perpage']).' of '.$photos['total'].' photos'; $output .= "</center>"; print $output; ?>
URL: http://www.crowdpublishing.com/vgp/archives