getSpreadsheetEntry('https://spreadsheets.google.com/feeds/spreadsheets/' . $spreadsheet_key);
// Get worksheets in this spreadsheet, should be only one
$wsFeed = $ssEntry->getWorksheets();
} catch (Exception $e) {
die('ERROR: ' . $e->getMessage());
}
// FIX HTML ENTITIES!!!!!!!!!!!!!!!!!!!!!!!! < and >
// Fix Microsoft Word Greek characters
$microsoft_greek = Array('α', 'β', 'γ', 'δ');
$html_greek = Array('α', 'β', 'γ', 'δ');
// Get worksheet data
foreach ($wsFeed as $wsEntry):
$rows = $wsEntry->getContentsAsRows();
foreach ($rows as $row):
foreach($row as $key => $value):
// Populate data arrays for manipulation
// $all_keys[] = $key; // Don't really need the keys, because the header titles are in the values
$all_values[] = str_replace("\n", "
", $value);
endforeach;
endforeach;
endforeach;
// Populate data arrays for later manipulation
$total_rows = count($all_values) / count($row);
for ($y = 0; $y < count($all_values); $y++) {
// Populate the header and text arrays
if ($y < count($row)) {
$all_headers[] = $all_values[$y];
} else {
$all_texts[] = str_replace($microsoft_greek, $html_greek, str_replace("IMG_DIR", "./section_images", $all_values[$y])); // Replace IMG_DIR with actual directory of images
}
}
echo "<< Back to Outline
\n";
echo "
\n";
// Output the data
for ($z = 2; $z < count($all_headers); $z++) { // Start at the third column of the spreadsheet
echo "\n";
echo "$all_headers[$z] \n"; if ($z == 2) { // Print section title in huge font echo "" . strip_tags($all_texts[$z], ' ') . "\n"; } else { echo "" . strip_tags($all_texts[$z], ' ') . "\n"; } // Add quick links at top of document if ($z == 3) { echo " \n"; echo " \n"; } echo " \n"; } // Store the pearls text into an array to display on the side if ($all_headers[$z] == 'Pearls') { $all_texts[$z] = str_replace(" ", " ", $all_texts[$z]); $pearl_notes_array = explode(" ", $all_texts[$z]); } } echo " | \n";
echo " \n"; // Select a random paragraph $random_paragraph = rand(4, count($all_headers)-4); ?> 3) ? $y = 0 : $y = $y + 1; ?> =$pearl_notes_array[$x]?> |