2
0

pc_get_book_index.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. //获取书的目录-索引 包含缩减的正文
  3. require_once "../path.php";
  4. include "../public/_pdo.php";
  5. $currBook = $_GET["book"];
  6. if (substr($currBook, 0, 1) == "p") {
  7. $currBook = substr($currBook, 1);
  8. }
  9. echo "<index>";
  10. //open database
  11. PDO_Connect(_FILE_DB_PALITEXT_);
  12. $query = "select * FROM pali_text where \"book\"=" . $PDO->quote($currBook);
  13. $Fetch = PDO_FetchAll($query);
  14. $iFetch = count($Fetch);
  15. if ($iFetch > 0) {
  16. for ($i = 0; $i < $iFetch; $i++) {
  17. $level = $Fetch[$i]["level"];
  18. if ($level == 100) {
  19. $level = 0;
  20. }
  21. echo "<paragraph>";
  22. echo "<book>{$Fetch[$i]["book"]}</book>";
  23. echo "<par>{$Fetch[$i]["paragraph"]}</par>";
  24. echo "<level>{$level}</level>";
  25. echo "<class>" . $Fetch[$i]["class"] . "</class>";
  26. echo "<title>{$Fetch[$i]["toc"]}</title>";
  27. echo "<language>pali</language>";
  28. echo "<author>cscd4</author>";
  29. echo "<edition>4</edition>";
  30. echo "<subver></subver>";
  31. echo "</paragraph>";
  32. }
  33. }
  34. /*查询结束*/
  35. echo "</index>";