Code Monkey home page Code Monkey logo

apinstall's Introduction

Apinstall v0.0.6 (project closed)

The end of blank pages while running PHP intensive scripts.

(works with: IE, Opera, Firefox, Chrome, Safari)


Functionalities:

  • Intensive php processes can be visible to user
  • Application installing process visible to user
  • Fun dealing with process bar ;)

How it`s made? It is hard?

Class is very simple to implement its consist of:

  • 80% of PHP
  • 5% of CSS
  • 15% of jQuery javascript

Example

(full example avaible in zip archive: install.php)

Put this in your site header

require_once('class/class.install.php'); //inlude apinstall class  
$install = new Installer(); //initialize it

Then this can be in body tags or whatever you want

$install->setLogPath('/home/user/public_html/apinstall'); //path to logfile
//no trailing slash!

$install->setSteps(3); //set how many steps there will be (3 in this example)

$install->defineBar('#E54000', '#E54000'); //choose colour of ( bar, text)

$install->placeholder(); //define place for your progress bar

Then create submision form, don`t forget: form id="apiform" target="progressFrame" and input id="apisubmit" for submit button.

For example it can looks like in the example:

<form id="apiform" target="progressFrame" method="post">
<input id="apisubmit" type="submit" name="submit" value="Show me how it works!"> 
					</form>

Ok, main part of this script:

#1 step
$output = 'Sending mails'; //title of this process
$install->save($output);
/*
Process itself (f.e sending mails)
*/

#2 step
$output = 'Optimizing database';
$install->save($output);
/*
Optimizing database code
*/

//Inform user that script has finished

#3 step
$output = 'Completed';
$install->save($output);
$install->delay(5); //make delay in seconds to show finished state longer.

Advanced options

If you have already included jQuery library put true inside initiatior

$install = new Installer(true); //initialize it

Delay function can be also smller than 1 second. Remember to add this function under your process code.

$install->delay(0.20); //0.2 sec of delay

Clearing temporary files can be used in two ways:

$install->clearTemp(); //clear files

$install->clearTemp(true); //delete files

Restrictions

  1. Work on PHP 5.0 or higher
  2. Class have to be initialized in head sector
  3. Logfile path folder have to be writable
  4. Animation of progress bar visibility from 0.1 sec not less

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.