Jump to content

Archived

This topic is now archived and is closed to further replies.

KevinM1

Newb question on URLs

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.