Reputation: 3
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?
Upvotes: 0
Views: 391
Reputation: 522
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.
Upvotes: 0
Reputation: 157334
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
}
?>
Upvotes: 1