Ruby on Rails first try
MissingSourceFile (no such file to load -- irb): (...)
You must install the following packages:
apt-get install ruby1.8-dev apt-get install irb apt-get install libncurses5-dev libreadline5-dev
MissingSourceFile (no such file to load -- irb): (...)
You must install the following packages:
apt-get install ruby1.8-dev apt-get install irb apt-get install libncurses5-dev libreadline5-dev
Debian is currently the fastest growing Linux distribution for web servers, with more than 1.2 million active sites in December. Debian 3.1 was declared stable in July and it appears that both the anticipation of this release becoming stable, and the release itself, have generated new interest in Debian, after some years where it had lagged behind its more active rivals. This growth is particularly noticeable at some of the larger central European hosting locations, including Komplex, Lycos Europe, Proxad and Deutsche Telecom.
<?php
include_once ‘class.FormManager.php’;
class FormLogin extends FormManager {
public function __construct() {
/*
* Calling the parent
* Usage::
* parent::__construct($name,
* $action = null,
* $method = null,
* $enctype = null,
* $extra = null);
*/
parent::__construct(‘FormLogin’, null, ‘POST’, null, null);
}
// Must implement this method
public function initElements() {
/*
* Adding an Hidden Element
* Usage:
* $this->addHiddenElement($name, $value);
*/
$this->addHiddenElement(‘module’, ‘Authentication’);
$this->addHiddenElement(‘action’, ‘login’);
/*
* Adding an Element
* Usage:
* $this->addElement($type, $name, $label, $options);
*/
$usernameOptions = array(…)
$this->addElement(‘text’,
‘username’,
‘Username’,
$usernameOptions);
/*
* Adding a Validator
* Usage:
* $this->addValidator($elementName, $validatorObject);
*/
$this->addValidator(‘username’,
new RequiredValidator());
$this->addValidator(‘username’,
new MaxLengthValidator(array(‘length’=>15)));
$passwordOptions = array(…)
$this->addElement(‘password’,
‘password’,
‘Password’,
$usernameOptions);
$loginOptions = array(…);
$this->addElement(’submit’, ‘login’, ‘Login’, $loginOptions);
}
}
$form = new FormLogin();
$form->render(); // render HTML form
echo $form->getFormStart();
// show the Username label
echo $form->getElementLabel(‘username’);
// show the Username imput
echo $form->getElementInput(‘username’);
// show the Password label
echo $form->getElementLabel(‘password’);
// show the Password input
echo $form->getElementInput(‘password’);
// show the Login submit button
echo $form->getElementInput(‘login’); // show the Login submit button
echo $form->getFormEnd();
?>
Another way is to load the XML configuration for the form:
<?php
include_once ‘class.XMLFormManager.php’;
$form = new XMLFormManager(‘FormLogin.xml’);
$form->render(); // render HTML form
echo $form->getFormStart();
echo $form->getElementLabel(‘username’); // show the Username label
echo $form->getElementInput(‘username’); // show the Username imput
echo $form->getElementLabel(‘password’); // show the Password label
echo $form->getElementInput(‘password’); // show the Password input
echo $form->getElementInput(‘login’); // show the Login submit button
echo $form->getFormEnd();
?>
In the XML way is quicker, i have a web application to generate the XML automatically. I can create or load XML forms and edit with an interface. I can bind elements with database table fields, add and configure validators, etc.
Recently i’ve improved the package to support the binding of an element with a database table field, the syntax is similary but with 2 more parameters in the addElement() method.