Qarib Haider
Qarib Haider

Reputation: 4906

Create Pages Automatically

Is there any method in Php by which I can create a page automatically based on a predefined template. Like if we create a new post in blogger it automatically creates page for that post with the name of that post, like this one:

http://learntoflash.blogspot.com/2009/12/exit-button-in-flash.html

Here Exit Button In Flash is the name of my post I have written and an automatic page is created for it.

Or like here on this website if we ask a question it automatically creates a page for that question. I want to know can I achieve this in Php or anything close to this ?

Upvotes: 2

Views: 3314

Answers (4)

Mohsen
Mohsen

Reputation: 393

You should use URL rewriting. This Apache module lets you define rules to rewrite web addresses in your desired way.

The process to make your web application ready for this, is not a short story so you should read more about it.

This article is a good starting point:

http://articles.sitepoint.com/article/guide-url-rewriting

Upvotes: 2

Breezer
Breezer

Reputation: 10490

to something like that you have to grasp the very fundamental in php or any programming language at all, i mean the core of php is to create dynamical generated pages based on user/browser input.

You might need to take a quick tutorial about php might I suggest http://www.tizag.com/phpT/ good step for step tutorial

Edit:

if you're wondering how the websites seems to have created a html page for every question, the answer would be they're not they are probably using mod_rewrite as mentioned before to rewrite to url to print a little more user friendly url, the actual url could be something like this https://stackoverflow.com/index.php?post=4499289 in reality

Upvotes: 0

alex
alex

Reputation: 490153

...here on this website if we ask a question it automatically creates a page for that question.

It sounds like you may believe an actual file is created when you post a question. My bet would be that this page is generated via the question id in the URL.

The only files created would be cached output, which may or may not resemble actual HTML pages.

Upvotes: 3

fredley
fredley

Reputation: 33881

This is acheived by using mod_rewrite. A good place to look for inspiration is the .htaccess used in Wordpress.

Upvotes: 1

Related Questions