コード例 #1
0
function getStoryFromRequest() {
  $news_office = new NewsOffice();
  if(isSearchResult()) {
    $search_results = $news_office->get_search_results($_REQUEST['query'], seekSearchID()+$_REQUEST['search_id'], 1);
    return $search_results['items'][0];
  } else {
    return $news_office->get_news_story(channelID(), $_REQUEST['story_id']);
  }
}
コード例 #2
0
ファイル: index.php プロジェクト: roycefu/MIT-Mobile-Web
    $load_next_story_id = $last_story['story_id'];
  }

  $first_story = $stories[0];
  if($news_office->get_first_story_id($channel_id) == $first_story['story_id']) {
    // no previous stories exists                                                                                             
    $load_previous_story_id = NULL;
  } else {
    $load_previous_story_id = $first_story['story_id'];
  }

  $next_previous_data = new LoadNextPreviousData(array("channel_id" => channelID()), "seek_story_id", $load_next_story_id, $load_previous_story_id, 'next');
}

$channels = channels();
$channel_title = $channels[channelID()];
if($next_params = $next_previous_data->load_next_params()) {
  $load_next_url = "./?" . http_build_query($next_params);
}
if($previous_params = $next_previous_data->load_previous_params()) {
  $load_previous_url = "./?" . http_build_query($previous_params);
}

$next_phrase = isSearchResult() ? "Next" : "Older articles";
$previous_phrase = isSearchResult() ? "Previous" : "Newer articles";

if($page->branch == 'Webkit') {
  // capture the items html
  ob_start();
    require "$page->branch/items.html";
  $items_html = ob_get_clean();