Hey,
I am just starting to learn PHP, I have my template all ready and divided into header, content and footer files and using PHP to include them into the index.php (Is this a good method?)
I have seen numerous ways of people including content using ‘switches’ and ‘GET ‘ and am confused what is the correct way to include content.
Can someone please advise me what is a ‘good’ way to set up navigation? or where I can find some information to do with this?
Thank you
Newbie: Advice for navigation
Started by Andy82, Mar 17 2008 10:07 AM
7 replies to this topic
#1
Posted 17 March 2008 - 10:07 AM
#2
Posted 17 March 2008 - 06:38 PM
No real 'Good' way of doing it. There are more efficient and it usually comes down to preferences.
I personally use the get method to switch between pages.
I personally use the get method to switch between pages.
$page = $_GET['section'];
if(!isset($section)) {
include("indexpage.php");
}
else if(isset($section) && $section == "about") {
include("aboutus.php")
}
else ....
#3
Posted 17 March 2008 - 08:43 PM
It totally depends, one way to do it is to write out your entire page in HTML, and have all the content within different divs call different functions of a controller class. A simple include works just as good, as well as a case switch statement. What ever you prefer really, as long as its easy for someone to understand what you are doing.
#4
Posted 18 March 2008 - 07:00 AM
Thank you for the replies
.
One other thing, can you recommend any good books for learning PHP that are on e.g. Amazon? I have been looking through them and don't want to spend about £60 on a couple of books that are not the kind of thing I need. Being completely new to PHP what sort should I buy? A general PHP book? one for PHP 5? and there are several for PHP 6???
This is probably a popular question, but just a point in the right direction would be greatly appreciated.
Thank you.
One other thing, can you recommend any good books for learning PHP that are on e.g. Amazon? I have been looking through them and don't want to spend about £60 on a couple of books that are not the kind of thing I need. Being completely new to PHP what sort should I buy? A general PHP book? one for PHP 5? and there are several for PHP 6???
This is probably a popular question, but just a point in the right direction would be greatly appreciated.
Thank you.
#5
Posted 18 March 2008 - 02:06 PM
This is my favorite book Beginning PHP5, Apache, and MySQL Web Development
I have the PHP bible, and its not that great, I would not buy it. Out of the three books I own, that is by far the best for a beginner. After that the Zend Developer Zone is your best resource.
I have the PHP bible, and its not that great, I would not buy it. Out of the three books I own, that is by far the best for a beginner. After that the Zend Developer Zone is your best resource.
#6
Posted 18 March 2008 - 06:07 PM
Sorry but i can't recommend a book, but i learned all the PHP I know how from P2L and php.net 
The best book is the free one
The best book is the free one
#7
Posted 18 March 2008 - 06:23 PM
BigDog, on Mar 18 2008, 11:07 PM, said:
Sorry but i can't recommend a book, but i learned all the PHP I know how from P2L and php.net
The best book is the free one
The best book is the free one
I wouldn't exactly sum it up in those words, but the idea is right there. There is no need to spend money on books when you have the whole internet as a free resource, as php gets more advaned a book won't update itself, you would need to keep buying new ones.
Like BigDog said you have P2L which has a whole range of tutorials from simple new stuff to more advanced stuff, and php.net is your bible for learning php.
Matt
#8
Posted 19 March 2008 - 05:43 PM
Mr. Matt, on Mar 18 2008, 07:23 PM, said:
BigDog, on Mar 18 2008, 11:07 PM, said:
Sorry but i can't recommend a book, but i learned all the PHP I know how from P2L and php.net
The best book is the free one
The best book is the free one
I wouldn't exactly sum it up in those words, but the idea is right there. There is no need to spend money on books when you have the whole internet as a free resource, as php gets more advaned a book won't update itself, you would need to keep buying new ones.
Like BigDog said you have P2L which has a whole range of tutorials from simple new stuff to more advanced stuff, and php.net is your bible for learning php.
Matt
I disagree with that, to me I find that books are a great starting point. I just don't like reading a lot on my computer. Once you know a programming language then I find tutorials, and online resources to be best for inspiration and advancing your learning. But thats just me.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
