问题
I would like to create an install.php for my tiny cms but i have a lot of questions.
-How to display install.php before the index.php?
-I would like to create steps, like in a shopping cart. The steps are:
step1: (hi! are you ready? -submit-)
if step1 is completed->step2:form(database-host-user-pass)->saves config.php and creates the tables
if step2 is completed->step3:(admin username,admin pass,page title)->insert into admin
if step3 is completed->step4:the install.php deletes itself.
-Is it possible to do it with one file?
I have most of the code of the steps in a file, the last question is, how to create steps.
Do i have to do something with session or with some id-s? How to?
回答1:
There are plenty of ways you could do this.
Why not rename
install.phptoindex.phpand then renameindex.phpto something likebegin.phpAnd then on your
begin.phppage you could do a series of divs and only display one of them at a time. When you click the "next" button, div1 would disappear, and div2 would appear. And so on and so forth. I made a jsfiddle that kind of demonstrates this: http://jsfiddle.net/vVsAn/2110/ Note that this assumes you have jquery installed.Instead of deleting
install.php(which is nowindex.php) you would put a check at the top ofindex.phpthat goes something like thisif (installed == true) { //show content } else { //show installer divs }
回答2:
This is the solution: http://tutsforweb.blogspot.hu/2012/02/php-installation-script.html I hope, it will be useful to everybody with the same problem.
来源:https://stackoverflow.com/questions/22467892/how-to-create-install-php-including-steps-like-a-shopping-cart