Jump to content


Photo

Newb question on URLs


  • Please log in to reply
4 replies to this topic

#1 KevinM1

KevinM1
  • Moderators
  • Snarkimus Prime
  • 5,248 posts

Posted 27 October 2006 - 02:13 PM

I wasn't exactly sure where to ask this.  I was thinking about putting it in the design section of the forum, but this seems too general for that.  In any event, here's my question:

I've seen a lot of URLs, especially in message boards, that have a structure like: www.somesite.com/forum/viewthread.php?forum_id=1&thread_id=1#post_1234.  Even the address of the page I'm at right now ends in ?action=post;board=14.0.  Something like that is basically a $_GET[] way of producing the correct page, right?  Is there any particular reason as to why this action method is the method of choice for things like message boards?
Using 'global' is a sign of doing it wrong

#2 gmwebs

gmwebs
  • Members
  • PipPipPip
  • Advanced Member
  • 174 posts
  • LocationLondon

Posted 27 October 2006 - 03:12 PM

I guess one benefit is that you can bookmark the page? If you were using POST to navigate around, or session variables, then you would not be able to bookmark the page you were visiting.

#3 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 27 October 2006 - 03:26 PM

what gmwebs said to an extent is valid. generally though, URL parameters are used to cause a single page to perform multiple tasks - be it different views, features, pages, etc - i.e, a dynamic page.
other forms of user input - post ($_POST) for example - arent really suited to this sort of thing, mainly because they require an action from the user (POSTing a form, in this case). URL's like this one can be performed without this type of action.  $_GET = what to get from the server, $_POST = what to post to the server.

without $_GET, you'd have an index page, a category page, a forum page, a topic page, plus all the additionals that go with it. i like to personally use $_GET to group together pages with a similar function all into one tidy 'package'. there are other benefits too (development, especially) but these are generally the main ones.
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#4 KevinM1

KevinM1
  • Moderators
  • Snarkimus Prime
  • 5,248 posts

Posted 27 October 2006 - 03:46 PM

Ah, okay, I think I've got it.  In the first URL I made, the values sent are handled by viewthread.php, correct?  And the links themselves are basically put together by getting the info from the database and appending them to the end of the link.
Using 'global' is a sign of doing it wrong

#5 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 27 October 2006 - 04:07 PM

pretty much got it in one. forming these URL's isnt restricted to just being formed by the DB, but is definitely the common way. in the case of message boards/forums, etc, this is the case, and normally the id (eg, forum_id, thread_id, etc) relates directly to the primary key of a database record (because it's unique).
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users