|
Website Design and Content Discussion pertaining to website design : Everything related to Databases , Graphics & Multimedia , Programming , HTML ,.. |
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
PHP tutorial, for PHP navigation.
Allot of people ask me how to do those "cool" page nav URL's in PHP
Code:
i.e. http://www.yourwebsite.com/index.php?page=downloads So in this tutorial i am going to explain how to do it! This is pretty baisic code so it shouldn't get too confusing. PHP Code:
"$HTTP_GET_VARS[page]" now this bit is the main part, the bit where is says [page] thats what the file is going to be, so for this example to get to the downloads page we go to index.php?page=downloads But if you changed that [page] to say [nav] then it would be index.php?nav=downloads "default:" this is the next bit you need to think about, this is your default page, so say if someone just went to index.php then this is the bit that would be told to display. include "site/index.php"; This is most likely the phrase you will use the most at a baisic level of PHP, this is the include page tag, so in this case we are saying If someone points there browser to [Only Registered users can see links . Click Here To Register...] then its going to include the file site/index.php "break;" This bit is just telling the server that thats the end of the code for that case. case 'resources=downloads': This is for the downloads page, so when someone visits [Only Registered users can see links . Click Here To Register...] then its going to include site/downloads.php "}" This is telling the server, that your now not defining the contents of [page] Right then! Summing up: switch ($HTTP_GET_VARS[page]) - You change the "page" thing to what you want it to be.. i.e. if you want it to be index.php?number=somthing then you change it from switch ($HTTP_GET_VARS[page]) to switch ($HTTP_GET_VARS[number]) case 'resources=downloads': - for this you must remmeber not to remove the "resources=" bit if you do, it won't work! but the bit after the = sign, change that to what you want to be. So final example. PHP Code:
The fact that i have used index.php?somthing=somthing in this example means nothing.. you can put this on any page that you want so it could be [Only Registered users can see links . Click Here To Register...] if you so desired :P Hope you all got it, and enjoyed it and have learned somthing! Cheers
__________________
[Only Registered users can see links . Click Here To Register...] |
#2
|
|||
|
|||
Not Found
The requested document was not found on this server. Web Server at yourwebsite.com |
#3
|
|||
|
|||
PHP one type of programming language. It is very useful for create website. It is easily understand language. If you want to learn then you can get many information in internet. It is very useful for web developer.
__________________
[Only Registered users can see links . Click Here To Register...] |
#4
|
|||
|
|||
Well, this is very useful and informative post. But for a person who is a beginner it would be somewhat typical to understand some of the parts of the coding. I would also like to say that for the beginners w3schools is one of the best websites through which they can gain a strong knowledge upon PHP.
__________________
[Only Registered users can see links . Click Here To Register...] |
Bookmarks |
Tags |
php navigation, php tutorial |
|
|