导航列表内容检索如何工作?

In one webpage, I have a sidebar whose items have contents of the same nature but different from one another; for example:

<ul> 
  <li>Science books</li>
  <li>Fiction books</li>
  <li>History books</li>
</ul>

If the user clicks on any of these, a bunch of related books should be shown to him.

My question is: does the developer have to make separate pages for each of these items to show their contents in them or is there a way to create a common page so that once an item is clicked, its content is shown in that common page? (I'm not talking about using JavaScript here).

Yes it would be possible with PHP, I would recommend you store your books inside a MYSql Database with a good structure similar to:

Type   -   Name           -   Genre
Book   -   My Adventure   -   Science
Book   -   The End        -   History

You could add more columns for things like image etc.

Using PHP you could make one page say books.php then make the link to it books.php?type=science

Then on this php page you could connect to your database and do a query to select all books with the type as science, you can get the variable from the url with $_GET["type"]

Something like this:

<?php
$con=mysqli_connect("ip","user","pw","my_db");
$type=$_GET["type"];
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT * FROM products WHERE genre = $type");

while($row = mysqli_fetch_array($result))
  {
  echo $row['type'] . " " . $row['name']. " " . $row['genre'];
  echo "<br>";
  }

mysqli_close($con);
?>

In the above example products is the name of your table. The query to get the books is on the $result variable, and we are selecting all results from the table products where the genre is your url parameter

uyou can do it another way:

<ul> 
 <li>Science books
    <ul>
      <li>
         <div class="hidden"> YOUR BOOK CONTENT </div>
      </li>
    </ul>
 </li>
 <li>Fiction books</li>
 <li>History books</li>
</ul>

It is not necessary to create a new page for each, you can simply pass a GET var in your URL and load the results accordingly, for example

<a href="page.php?content=books">See Books</a>

On page.php

Just show the content according to the $_GET value for example

if(!empty($_GET['content'])) { //Just to make sure content is set and its not empty
   $show_content = $_GET['content']; //books
}

if($show_content == 'books') {
   //Show Books
} elseif($show_content == 'gadgets') {
   //Gadgets Go Here
}

Note: Just make sure you validate and sanitize the $_GET['content'] value as it can be easily modified by any user.