Forum Moderators: coopster
I have read some topics regarding url with multiple variables (index.php?........).
From what I have read, there are two important points that I should not ignore :
1/ Not to have a variable called $id
2/ Stick to 2 or 3 variables max
My website is a databank of pictures and user can see pic in thumbnail formats. Because they have the possibility to set a number of results, to order them differently, type search keywords, etc... my url can have upto 8 variables. Though, I have done a small php script to remove the var from the URL when the variable is NULL, I am not satisfied and am afraid that my HEAVY databased website will not be fully indexed.
I am aware of the mod_rewrite in Apache, but I'd like to know if there are other alternatives. Is placing variable (such as $order, $qty) in session is a good procedure or should I just eliminate these features in order to reduce my URL?
Thanks
You could have a URL that looks like this:
[foo.com...]
Then when your page reads that variable, it parses out such that 11 in the first two digits position means do this, 22 in the second two digits positions means do that, 33 in the third two digits position means put it in such and such order, etc. etc.
I have no idea how practical it is but I don't see why it wouldn't work if you use strings of the same length all the time (where, for example, 00 would mean do nothing).
function makevar($tid,$torder,$tqty){
//add code to check validity of vars and then
return $tid . '-' . $torder . '-' . $tqty;
} Then I'm just passing one var instead of 3 also makes it easier to use with mod_rewrite too.
When the var is passed I just explode into an array and process the vars as needed.
baze
From what I have read, there are two important points that I should not ignore :1/ Not to have a variable called $id
[search.ebay.com...]
Notice the variable names, "catref", "from", "sacategory", "sosortorder", and "sosortproperty". Funny what you notice when you're looking.