开发者

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 ?


...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.


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


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜