0

Say, if I have a website http://website.com/

How do I allow each of my navigation tabs to load a new page with the address, for example, http://website.com/?=newpage

What file names should my other html pages be?

000
  • 3,976
  • 4
  • 25
  • 39
Darren
  • 3
  • 2
  • Either URL rewriting (must be server side), or one page that put different contents based on the querystring value. Can be server side or client side. – Shadow The GPT Wizard Dec 20 '12 at 08:34
  • The ? statements are mainly used for code like PHP, ASP ect. Not HTML. They are used for sending value's to a different page for example. – Ladineko Dec 20 '12 at 08:34
  • @Ladineko it's possible to have one "default.html" page set as the default page and read the querystring value with JavaScript. Server side is not a must. – Shadow The GPT Wizard Dec 20 '12 at 08:35

2 Answers2

1

There are no different files to load the content from, it is simply a GET variable with a value in URL, you need Server side or jQuery to load the respective content on your page

PHP For Example

<?php
if(isset($_GET['page']) && $_GET['page'] == 'first_page') {
?> 
Whatever you type in here shows when url is like www.example.com?page=first_page
<?php
} elseif($_GET['page']) && $_GET['page'] == 'second_page') {
?>
Whatever you type in here shows when url is like www.example.com?page=second_page
<?php
}
?>
Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
  • "Whatever you type in here shows when ..." is extreme oversimplification leading to the asker being confused with mysterious errors. – John Dvorak Dec 20 '12 at 08:38
  • @JanDvorak Well I can't make it more cleaner, he needs to learn the basic atleast to catch up...or take a look for jQuery tabs examples :) – Mr. Alien Dec 20 '12 at 08:43
  • Thanks for the answer. I guess I'll use jQuery instead of PHP to load the new content. I did a little searching and found this as well: http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery – Darren Dec 20 '12 at 14:20
  • @Darren happy programming :) – Mr. Alien Dec 20 '12 at 14:20
  • @Mr.Alien Thanks :) I managed to use js document.URL.split and jQuery hide(); and show(); to get the job done. – Darren Dec 20 '12 at 21:59
0

You need to use a server-side language to parse the query string (everything after the question mark (?)). The actual page is the default (usualy index.html). You could also use JavaScript, but this approach is more complex and has issue with clients that don't support it.

silverstrike
  • 522
  • 2
  • 7