Hello,
I've read several tutorials on php before and I have mostly worked with includes for web site purposes.
Now, however, I need to create a website for books to be viewed online. And making a separate php file for each page of the book(s) is not what I would like to go through. Instead, I thought, there must be a way to just "switch" one part of the website for another - meaning switch on include for another.
So if a person was reading book 1, and clicked on the page 4 link, then the url would look something like books.php?id=1&page=4 and the page include would change to load page 4.
Some one recommended if statements, but I can't seem to get them to work. I understand what they are, but how will they help my website? Most tutorials I have visited on the net talk about if statements for programming purposes and databases.
Any help or a push in the right direction would be most welcome.
I hope my english is clear enough, and sorry if it isn't.
Includes... and if statments?
Moderator: General Moderators
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
Code: Select all
switch ($_GET['book'])
{
case "some_book":
include('some_book/'.$_GET['page'].'.html');//tweak this
break;
case "other_book":
include('other_book'.$_GET['page'].'.html');
break;
default:
include('index.php');
}