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']);
  }
}
Example #2
0
  }

  $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();
  $items_json_html = json_encode(array(
    'next_params' => $next_params, 
    'previous_params' => $previous_params,
    'items_html' => $items_html));
  $previous_params_json = json_encode($previous_params);
}

if(isset($_REQUEST['ajax'])) {
  echo $items_json_html;