Flogr – Add Interestingness View

To add an Interestingness view to your Flogr install it takes 5 Easy steps as demonstrated here.

Step 1 – Edit your /pages/photo.php
Step 2 – Edit your /admin/flogr.php
Step 3 – Edit your /themes/blackstripe/menu.php
Step 4 – Create /pages/interesting.php file
Step 5 – Create /themes/blackstripe/interesting.php file

You can download a .zip of all the modified files flogrinteresting.zip

Step 1 – Edit your /pages/photo.php
Remove

 function get_user_interestingness_photos(
$date = null, $extras = null, $perPage = null, $page = null) {
$p = new Profiler();
$this->photoList = $this->phpFlickr->interestingness_getList(
$date,
$extras ? $extras : FLOGR_PHOTO_EXTRAS,
$perPage ? $perPage : $this->paramPerPage,
$page ? $page : $this->paramPage);
return $this->photoList;
}

function user_interestingness_photos(
$date = null, $extras = null, $perPage = null, $page = null) {
$p = new Profiler();
echo $this->get_user_interestingness_photos($date, $extras, $perPage, $page);
}

 

Relplace with

function get_user_int_photos(
$userId = null,
$tags = null,
$sort = 'interestingness-desc',
$extras = null,
$perPage = null,
$page = null ) {
$p = new Profiler();
$photoSearchParams = array(
"user_id"=>$userId ? $userId : FLICKR_USER_ID,
"tags"=>$tags ? $tags : $this->paramTags,
"sort"=>$sort ? $sort : $this->paramSort,
"extras"=>$extras ? $extras : 'original_format,date_taken,date_upload',
"per_page"=>$perPage ? $perPage : $this->paramPerPage,
"page"=>$page ? $page : $this->paramPage);

$this->photoList = $this->phpFlickr->photos_search( $photoSearchParams );
return $this->photoList;
}

function user_int_photos(
$userId = null,
$tags = null,
$sort = 'interestingness-desc',
$extras = null,
$perPage = null,
$page = null ) {
$p = new Profiler();
echo $photos = $this->get_user_photos($userId, $tags, $sort, $extras, $perPage, $page);
}

Step 2 – Edit your /admin/flogr.php
Add 'interesting' => 'interesting.php', to pageMap array as below

</pre>
<blockquote><code>
var $_pageMap = array(
'' => 'photo.php',
'photo' => 'photo.php',
'recent' => 'recent.php',
'interesting' => 'interesting.php',
'sets' => 'sets.php',
'tags' => 'tags.php',
'map' => 'map.php',
'map_data' => 'map_data.php',
'favorites' => 'favorites.php',
'about' => 'about.php',
'rss' => 'rss.php'
);

 

Step 3 – Edit your /themes/blackstripe/menu.php
Add

 <a id="menuitem_interesting" href="index.php?type=interesting">Popular Pics</a> 

As below

</pre>
<blockquote>
<ul>
<ul>
	<li><a id="menuitem_home" href="/">Home</a></li>
	<li><a id="menuitem_recent" href="index.php?type=recent">Recent</a></li>
	<li><a id="menuitem_interesting" href="index.php?type=interesting">Popular Pics</a></li>
</ul>
</ul>
<ul>
<ul>
	<li><a id="menuitem_sets" href="index.php?type=sets">Sets</a></li>
	<li><a id="menuitem_tags" href="index.php?type=tags">Tags</a></li>
	<li><a id="menuitem_map" href="index.php?type=map">Map</a></li>
	<li><a id="menuitem_about" href="index.php?type=about">About</a></li>
</ul>
</ul>
</blockquote>
<pre>
 

Step 4 – Create /pages/interesting.php file

Create both these files containing

<?php
require_once( 'photo.php' );
?>

Step 5 – Create /themes/blackstripe/interesting.php file

      <div id="leftcontent"></div>

      <div id="centercontent">
        <div id='page_header'>
          <span id='page_title'>
          	<?php
          		if ( $photo->paramTags ) {
          			echo $photo->paramTags;
          		} else {
          			echo "Interesting";
          		}
          	?>
          </span>
          <span id='page_nav'>
          	<?php
          		$photos = $photo->get_user_int_photos();          	
          		$photo->next_page_link($photos, 'prev ') . $photo->previous_page_link($photos, 'next');
          	?>
          </span>
        </div>

        <div id='page'>

            <!-- Show the photo and link the photo to the previous photo -->
            <div id='thumbnail_container'>
            	<?php
            		$photo->slideshow_thumbnails( $photos );
            	?>
            </div>
        </div>
      </div>
      
      <div id="rightcontent"></div>