Forum Moderators: mack
Sorry, probably haven't explained this very well - does anyone have any ideas on how to do this or if it's possible. Am trying to get round using dynamic pages. No search function is necessary..
Thanks
If you do need to save the page to the server, then be careful since people may use it to create pages of backlinks to their own sites, or promote their own products, etc.
If you're saving pages to the server then I agree that PHP or Perl would be the best way to go.
Yep, with JPspan [jpspan.sourceforge.net] or a XMLHttpRequest thingy [xulplanet.com] you could do it, but that would only be a JS "interface" to some other serverside thingy (former: php - latter: Perl, PHP, ASP, .NET, Java, Python, whatever, (example) [webmasterworld.com]), so you might as well do it fully serverside.
Another reason to do it serverside is that you will probably want the browser to go to that new page as soon as it's generated, so there's really no need for a JavaScript "middleman".
Doing this serverside (ie. with perl, php, asp, .net / whatever) means more than just writing a few lines of code unless you know exactly what kind of input and output you want.
One way to do it (without using a database) is:
1) Set up a template page with the information that should always be on the page.
1a) Add "placeholder tags" for the form-submitted information you want on the page (unique strings that you make up yourself)
2) Setup a form page with input fields for the extra information you want on the new page
3) Let the form post to a script (4)
4) Create a script, that:
4a) Accepts and validates data sent from form in (2)
4b) Retrieves the template page from (1) and parses it, inserting the values from the form in stead of your placeholder tags
4c) Saves the updated template page with some name in some folder
4d) Updates some file by inserting the name and URL of the new page
4e) Sends a "Location: somedomain.tld/pagename.htm" header to the browser, making it switch to the new page.
PART TWO: CREATING LINKS TO THE PAGE
On the pages you want to link to the new page:
1) make sure they are server parsed, ie. ".shtml", ".asp", ".php", ".pl", ".jsp", or whatever technology you wish to use
2) Make the page call a script that checks the file mentioned in part one (4d)
3) Make that script insert the link to the new page before the "page that links to" get displayed to the visitor.
PART TWO: ALTERNATIVE VERSION
Extend the script in part one (4) so that it will retrieve and parse the files/pages you want to link to the new page. Make the script insert links on those pages and save them. That way, they can be static pages as well.
Make this part happen after part (4e), ie. after your visitors get the new page. They should not have to wait for this.
There are always other ways to do it, but the steps above should be sufficient to get some kind of system operational without using databases. (yes, i know that technically, the file mentioned in (4d) is a "flat file database" - still, this is without a dedicated database application like "somethingSQL"