PHP Classes

File: examples/confirm.php

Recommend this page to a friend!
  Classes of Michele Brodoloni   PHP Dialog   examples/confirm.php   Download  
File: examples/confirm.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Dialog
Create console based UIs with the dialog program
Author: By
Last change: Added phpdoc-style comments to source code (most of)
Added a README file with installation instructions
Made some fixes into main class code
Made some changes to the example scripts and checked if they work

Date: 11 years ago
Size: 547 bytes
 

Contents

Class file image Download
#!/usr/bin/php
<?php

require_once '../include/class.dialog.php';

$dialog = Dialog::factory('confirm', array(
   
'backtitle' => 'Example: Confirm Dialog'
));

$dialog->setCaption("Are you a man?\n\n(Hint: Try the ESC key)")
       ->
trapEscKey(true);

$result = $dialog->show();

system('clear');
echo
"Result:\n";
var_dump($result);
echo
"\n";

if (
$result === true)
    echo
"Bad! You are a man...\n";
elseif (
$result === false)
    echo
"Good! You are a woman...\n";
elseif (
$result === null) // ESC KEY
   
echo "Awesome! You are an alien!\n";

echo
"\n";