For example, after I press the button to submit this thread, a new page is created for it. How does this work/what would be the right way to describe it?

I'm not sure where this should belong to so apologies if it's in the wrong forum.

Are you using some kind of programming language, or just HTML?

I'm guessing it would have to be in some sort of programming language, and I'm willing to learn whatever it may be--I have no idea right now how it would be achieved.

Im 99% sure this site is HTML front end with JavaScript for dynamic page enhancements (all the fun animation stuffs), CSS to make it pretty, with a PHP back end most likely drawing content fron a MySQL database.

The HTML is what gives the page "structure"
CSS tells the browser (IE, Chrome, etc..) what the layout/flow of the page should look like.
The Javascript breaks it... no wait.. it "enhances" it. That's the one... It also helps modify the CSS if necessary, or make calls behind the scenes.

The PHP is what does repetitive "dynamic" creation of content. It pulls data from a database (in DaniWebs case, most likely MySQL), and displays that content in the defined structure of the HTML/Javascript/CSS.

Is that what you were looking for?

To create dynamic pages, with regard to content, you need some type of server-side scripting language.

If you provide a bit more information about what you are trying to achieve, you'll get better answers and guidance.

Not sure if I'm misunderstanding any responses, but what I mean by 'new page' is that this url (http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/456118/dynamically-creating-new-page) did not exist before I posted this thread--somehow, afterwards, 456118/dynamically-creating-new-page was created/added to the threads directory of this site.

As a (hopefully) really simple example: a user types something into a text field in a site www.somesite.com. Let's say they put hello. After they press the submit button, a new page is created: www.somesite.com/hello.html.

So the box you type in is an element of a "FORM" (the HTML part).. specifically:

<form action="http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/456118/dynamically-creating-new-page" method="post" accept-charset="utf-8" id="reply-form" class="user-input"> ......

and a ton of other stuff they use to make it look pretty.

This form posts (method="post") a bunch of data (form elements, which have been omitted for space) to the page (action="....") and the page has PHP on it that knows how to handle the data.

Now lets say the page didn't exist (like you're saying).

Depending on how you have your structure set up, you can use PHP (or any server side language) to make a new directory or file based on whatever you have set up. In the case of daniweb, they rely on a folder defauling to index.php when an index.html is not present.

In php, you would use something like:

if (!file_exists('path/to/directory')) {
    mkdir('path/to/directory');
}

(borrowed the above from http://stackoverflow.com/questions/2303372/create-a-folder-if-it-doesnt-already-exist)

mkdir makes the directory, it's then up to you to tell it to make a page (or file) as well..

it may not be the exact way daniweb does it, but they probably use something similar to file_put_contents() or a series of functions that emulate it. You can find that here:
http://www.php.net/manual/en/function.file-put-contents.php

In short, there is a forum "template" that daniweb copies to a new directory based on the thread title. The directory is created upon the initial form post (the poster), and the page has script to handle successive setting and getting of data.

Hope that helps :)

Ryan

Oh I see where your thoughts are going here

456118/dynamically-creating-new-page was created/added to the threads directory of this site

no, not necessarily. with URL rewriting, what you see in the URL is not necessarily what is happening on the file structure of the website.

With regard to creating a new thread on this site...i have no visibility into how this site is designed, but Im 99.999% sure that there was no page created when you submitted your question. The path you referenced... 456118/dynamically-creating-new-page, is not pointing to a new page. The information in the URL is used to query the backend database so that information about thread #456118 is displayed on the screen. The "/dynamically-creating-new-page" really does nothing except for SEO (search engine optimization) so that when the search engines crawl this page, they have information about the content. From the website/webserver's perspective, the key information is "456118".

So your question, regarding if you type "hello" into an input box and a new page is created on the server... while yes that can be done, it's not typically an approach this is used. It would not effiecient to manage your dynamic data in that fashion. For example, a site like this one that may have millions of posts would then require millions of pages. That's not necessary... the data could be effeciently stored in the datbase and you can use one page to display the dynamic data.

For this URL -->
http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/456118/dynamically-creating-new-page

The actual page could be sitting anywhere on the website's folder structure. I'm confident that this site using URL rewriting so that when the webserver sees this URL, it will use information in the URL to bring up the correct page and display the correct information to the user. Most of the information in this URL is for SEO, not folder structure. For example (and this is only an example), the actual page could be this... http://www.daniweb.com/thread.php?q=456118. Then on the thread.php page, server-side scripting will pull the query string parameter and a call will be made back to the database specfically for information related to thread record #456118. The results are displayed back to the user and the user has no idea what actually occurred in the background.

Hope this clarifies it a bit for you.

Yes, the above is a much better approach :)

Note to self: don't answer questions late at night without thinking them through..

you are correct that making a new page each time would be a storage nightmare.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.