PHP Classes

File: examples/inputmenu.php

Recommend this page to a friend!
  Classes of Michele Brodoloni   PHP Dialog   examples/inputmenu.php   Download  
File: examples/inputmenu.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:
Date: 12 years ago
Size: 544 bytes
 

Contents

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

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

$dialog = Dialog::Factory('inputmenu');

$items= array(
    array(
'a', 'Apple'),
    array(
'b', 'Banana'),
    array(
'c', 'Ananas'),
    array(
       
'id' => 'd',
       
'caption' => 'Pear'
   
)
);

$dialog->addOptions($items)
       ->
setListHeight(count($items))
       ->
setWindowSize(30, 30);

$res = $dialog->show();

system('clear');
if (
$res === false) {
    die(
"You pressed ESC or hit CANCEL! Bad Boy!\n");
}

echo
"Cmd: ". $dialog->getCommand() . "\n";
die(
"\nYou eated: [". $res . "]\n\n");