Login   Register  
PHP Classes
elePHPant
Icontem

File: README.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Michele Brodoloni  >  PHP Dialog  >  README.txt  >  Download  
File: README.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: PHP Dialog
Create console based UIs with the dialog program
Author: By
Last change:
Date: 2012-04-11 17:51
Size: 2,184 bytes
 

Contents

Class file image Download
PHP Dialog v1.0
Author: Michele Brodoloni <mik.linux@gmail.com>

+--------------+
| DESCRIPTION  |
+--------------+
This class allows you to create pretty dialog boxes within your php-cli scripts. 
It relies on Linux "dialog" utility.

+--------------+
| REQUIREMENTS |
+--------------+
  * PHP 5.3 (due to a bug with proc_open() in PHP 5.1)
  * dialog 1.0 / 1.1 

+--------------+
| INSTALLATION |
+--------------+
  * Install the dialog utility using your favority package manager
    - apt-get install dialog     # (For Debian/Ubuntu)
    - yum install dialog         # (For RHEL/CentOS)
  * Download and extract this tarball
  * Place file class.dialog.php and the plugins directory wherever you want but in the same path.


+--------------+
| BASIC  USAGE |
+--------------+
To use this class just include it, and call the static factory() method to fetch the wanted object. 
Here's an example:

----------[ CODE:START ]--------------
<?php

    require_once 'path/to/class.dialog.php';
    $dialog = Dialog::factory($type, $params);

?>
----------[ CODE:END ]-----------------

* $type is the type of dialog requested. Possible choices are:
    - confirm
    - msgbox
    - gauge
    - inputbox
    - calendar
    - timebox
    - ... And so on. Just list files into 'plugins' directory.

* $params is an optional associative array which sets default params during object construction. 
  It could come handy when need to instantiate several dialog objects with the same values (such as title, backtitle, ecc..)


----------[ CODE:START ]--------------
<?php

 require_once 'path/to/class.dialog.php';

 $params = array(
    'backtitle' => 'My App',
    'title'     => 'Box title'
 );
 
 $d1 = dialog::factory('msgbox', $params);
 $d1->setCaption('Hello World #1')
    ->show();

 $secs=5;
 $d2 = dialog::factory('pause', $options);
 $d2->setCaption("Please wait $secs seconds.")
    ->setSeconds($secs)
    ->show();

?>
----------[ CODE:END ]-----------------


+---------------+
| DOCUMENTATION |
+---------------+

For further information please download and extract the zip file located
into the docs directory and then open the index.html file in the extracted
directory.