DrupalBin
Submit Code
About
Recent Posts
admin settings not saving
39 min 17 sec
ago
Code
1 hour 22 min
ago
Code
1 hour 38 min
ago
css path
3 hours 22 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for Some code to search flickr for images
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
function _optotrip_block_flickr() { $termtext = _optotrip_get_block_context(); if ($termtext == '') { return NULL; } $starttime = microtime(TRUE); lightbox2_add_files(); // perform search $args = array( 'text' => $termtext, 'per_page' => 16, 'sort' => 'interestingness-desc', // 'relevance', ); // if results found, emit block content if ($photos = flickr_photos_search('', 1, $args)) { $content = '<div class="myflickr">'; foreach ($photos['photo'] as $photo) { $content .= theme('flickr_photo', $photo, 's', array('rel' => 'lightbox[flickr]') ); // print theme('flickr_photo_box', $photo, 's'); } $content .= '</div>'; // HACK: add some padding to the flickr images drupal_set_html_head('<style type="text/css" media="all">div.myflickr img { padding: 5px; }</style>'); } else { $content = t('No photos found'); } // dsm("_optotrip_block_flickr($termtext) ===> ". (microtime(TRUE) - $starttime)); // return the block information return array( 'subject' => t('Flickr for: @name', array('@name' => $termtext)), 'content' => $content, ); }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.