|
#1
|
||||
|
||||
|
I have links on my page, but instead of linking to pages like:
Code:
<a href="guestbook.php">Guestbook</a> Code:
<a href="?page=1">Guestbook</a> |
|
#2
|
|||
|
|||
|
Quote:
Jakob Nielsen has a few guidelines regarding URIs and their importance as a UI feature, sentiments that are echoed elsewhere. What exactly makes you think this will be a good idea, either for visitors or yourself? Mike |
|
#3
|
||||
|
||||
|
It leaves off the extension, possibly making it easier to navigate.
|
|
#4
|
||||
|
||||
|
So how could I do this?
|
|
#5
|
|||
|
|||
|
So then why don't you aim for URIs like:
http://www.example.com/guestbook Still no "extension", but no unnecessary query string silliness. I've discussed how to implement extension-less URIs in the past - you even participated in one thread. Mike |
|
#6
|
||||
|
||||
|
I've read that post, I couldn't understand it.
Code:
So then why don't you aim for URIs like: http://www.example.com/guestbook |
|
#7
|
|||
|
|||
|
If I understood well, you want to use links that have that "?" in the end, like "<a href="login.php?user=username">Login</a>". Well, here's an example:
index.html Code:
<?
$user = $_POST[user];
if(user != NULL)
{
header("Location: members.php?user=$user");
}
?>
....
<body>
<form action="<? echo $_SERVER['PHP_SELF'];?>" method="post">
Username: <input type="text" name="user">
<br><br><input type="submit" value="Login">
</form>
</body>
Code:
<? $user = $_GET[user]; // you MUST use the "get" method if($user == "costas") // then verify it echo "Welcome oh COSTAS!!"; else echo "You are an unauthorized User!"; ?> Hope I helped!!! |
|
#8
|
||||
|
||||
|
The easiest way to do this is to construct a query-string mechanism as you describe here, then use mod_rewrite or equivalent to map /guestbook to /?page=1.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP! |
|
#9
|
||||
|
||||
|
Okay.. I think I get it now. Thanks Mwinter, Twey, and costas. PHP is awesome...
|
|
#10
|
||||
|
||||
|
You could, if you're just looking for a nice feel to the url, use page.php?guestbook
Then split the string of the url to work. PHP Code:
Note, though, that a major problem is that you can't use GET variables after this. If you wanted to specify something else with the URI, then the & would have to be there, and it would get messy, as that would be in the $page string as well. You could do some fancy coding, but it would just be a pain. In that case, you should definitely use ?page=.... instead. It would also make it clearer when making the URLs. One ?.... value is easy, but after that, using the normal syntax is much clearer.
__________________
Daniel - <?php?> | <html>| Ich lerne Deutsch. | Studio l'italiano. | Estudiaba español. | Estudo português. | 日本語の勉強。| मैं हिन्दी सीखो | درس العربية |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|