Guest User

Untitled

a guest
Dec 24th, 2010
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. <?php
  2.  
  3.     if(!isset($_POST['nextID']))
  4.     {
  5.         $entry = getEntry( getLastRecord()->getID() );  // get the last Entry from database
  6.     }
  7.     else
  8.     {
  9.         $entry = getEntry( $_POST['nextID'] );  // get the specified Entry from database
  10.     }
  11.  
  12.     $features = $entry->getFeatArray();     // get all features for Entry
  13.  
  14.     $arraySize = count($features);          // get the total # of features for Entry
  15.    
  16.     $dir = '../_images/'. $entry->getImage().'/';  // get Entry image directory
  17.     $numOfPics = numFilesInDir( $dir , FALSE );    // get # of pics in Entry's image directory
  18.    
  19.     // build all the images for return
  20.     for ($i=1;$i<=$numOfPics;$i++)
  21.     {
  22.         $return['image'.$i.''] = '<img src="../_images/'.$entry->getImage().'/'.$i.'.png" class="thumbs">';
  23.     }
  24.    
  25.     // build all the features for return
  26.     for ( $i=0; $i < $arraySize; $i++ )
  27.     {
  28.         $return['feature'.$i.''] = $features[0];
  29.     }
  30.    
  31.     // build all other variables for return
  32.     $return['error'] = false;      
  33.     $return['id'] = $entry->getID();
  34.     $return['date'] = $entry->getDate();
  35.     $return['title'] = $entry->getTitle();
  36.     $return['subtitle'] = $entry->getSubTitle();
  37.     $return['spotlightimage'] = '../_images/'.$entry->getImage().'/1.png';
  38.     $retunr['image'] = $entry->getImage();
  39.     $return['size'] = $arraySize;
  40.     $retunr['picsize'] = $numOfPics;
  41.     $return['description'] = $entry->getDescription();
  42.  
  43.     echo json_encode($return);
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment