If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

This is a fundamental aspect of server-side languages like PHP, etc. In this case, for some reason it's claiming to be an .html file, even though it most likely has something else going on (maybe CGI? maybe PHP pretending to be HTML by generating a .html URL?).

In terms of the URL, it's nothing special-- type anything you want, and that information will be available to the server. So I could type a URL like:
/mypage.html?myvariable=myvalue
[Note the URL for the forum pages here, or for any search you do on Google, and any number of other webpages.]

And then I could access "myvariable" with the value "myvalue" in a serverside language, and do something with it-- maybe query a database, maybe decide which external .html page to include, whatever.

But for making the serverside code work, you'll need to learn that. It's not especially hard, but it is something new, with completely new ideas compared to just using HTML. To be clear, the URL isn't doing anything at all-- it's just sending information to the server, then the server is doing something based on that information (and what it was programmed to do).

First, you'll need to see what serverside language(s) your host/account supports (or get a new host/account). PHP is widely available, while other options are a little more specialized (ASP only on Windows servers, and various other languages like Python only if you choose to install them-- probably not on a "share hosting" account in most cases). You may also want to check on the other features you have, such as whether databases are available, and whether PHP (or whatever) is limited to "safe mode" (which might be problematic) or has any other restrictions or extra features (such as extended libraries for additional functions). But for now, just see what languages you can use. I'll guess PHP because it's common, and if not you can easily get a new account (for about $5/month from various companies, and in rare, possibly very limited cases, for free) to test it out on if not.

Then you'll need to use what are called "get variables" in PHP (a kind of variable, not an action of "getting"). In short, for the example above, I'd write something like this:
<?php echo $_GET['myvariable']; ?>
That would output ("echo") "myvalue".
You can use $_GET[] to grab any of the URL variables you'd like. Then, obviously, you'd need to set up your PHP script to do something with that information. Maybe query a database, etc.
One very simple tool that is also very useful is called include():
<?php include('mypage.html'); ?>
That will grab all of the contents of "mypage.html" and dump them into the current page (as output, not changing the PHP code permanently). This is a very basic way to do what you're describing and it can help you keep your files organized.
Beyond this, get a foundation in PHP (or some other serverside language) first and work out the details from there.

By the way, there's also a very simple serverside language for just this purpose known as "SSI" or "server-side includes". I'm not sure how widely supported it is, but if you're only looking for this, that might work for you. It basically does PHP's version of include() without the rest of PHP. But PHP isn't all that hard to learn if you're up for something new anyway.

It's complicated and depends to a degree upon which server side language you are using. It also depends upon how you want to code it. There are many ways to utilize the information in the query string. There are templates you can use though, so you don't have to do everything from scratch. I'm most familiar with PHP. A simple example would be - page.php:

(By the way, you can reliably use == instead of === here because $_GET values will be strings based on the kind of input. Technically they could be something else, but I don't see how they'd end up that way, unless you're manually changing the values within $_GET, which is rarely necessary [unless you're doing some kind of extra layer of URL changes with .htaccess, for example, and even then they should still be strings, as if they were the original input]. Of course === won't hurt anything, so there's no reason not to use it either I guess.)

It's because they're strings that the more efficient === may be used. You only need to use == when you want type not to matter. It's more work for the processor though because it has to determine if the types are different, if one can be converted to the other, and then if they're equal or not after conversion.

But all of this is immaterial to the basic concept, which is all we're concerned with here. Except that it does illustrate in a small way how different code can be used for the same things. The question was almost too general, but I tried to Google it and found nothing basic. Are you aware of a good tutorial on this?

Oh, and the server can process the .html page as .php, .asp, or whatever, simply by setting that in the .htaccess file or the server config.

This same idea can be used to have only a portion of the page be different:

It's because they're strings that the more efficient === may be used. You only need to use == when you want type not to matter. It's more work for the processor though because it has to determine if the types are different, if one can be converted to the other, and then if they're equal or not after conversion.

Hm, I actually don't know which is more efficient. It might be more efficient to compare them without also comparing the types (that's how I've seen it phrased, that === is "== plus checking types"), or it might be more efficient to use === because it only checks one thing, or it might depend on whether they are or are not the same type (so that here it would not matter because they are).

The question was almost too general, but I tried to Google it and found nothing basic. Are you aware of a good tutorial on this?

No, not really. It is good general, because doing this requires some knowledge of a serverside language, yet with that knowledge it comes more or less for free. So a good place to start would be any tutorial on include() or just the documentation page on php.net with examples:http://php.net/manual/en/function.include.php
Of course that will require other things, like having PHP available on the server, knowing how to save a .php (rather than .html) page and so forth. But it's not too hard, and it's a reasonable way to learn-- that was in fact the first thing I did using PHP, just putting together information from a few tutorials/manuals.

The news page is where the magic happens. From the URL+query string that has been passed from the home page, $_GET takes the value of 'n' (John's example $_GET's the value of 'page') and then the contents of a similarly named file are pulled in. John's example uses include() while my test script uses file_get_contents(), which are similar functions, except that file_get_contents() will not allow scripts to execute from the file content it is getting. Include() will. You can decide which function is better for you.

Because include() allows scripts to execute, it will prove more useful when pulling in other dynamic content - here's a simple tutorial: http://www.tizag.com/phpT/include.php and from there you can begin to see how versatile/time-saving PHP can be. In fact, have a look at some of the related tutorials offered on that website because it will help build your basic PHP knowledge pretty quickly.

Yeah, good replies above. Think of it as you sending a request to the server with information, then the server responds and loads up your web page according. The same thing happens with this forum, ie,?74258-HTML-URL-Structure, where the 74258 is the thread number, located as a field in the db, or key.