Mits Web UI Framework for PHP
Show code
Menu

Introduction

Mits Core is a low level framework that makes the development of a web application easy and almost completely by using server side PHP and minimizing client side JavaScript code needed in most cases.

This demo shows many of the features provided by the framework. To see the source code of the current demo page click the <Show code> button at the top left.

Creating elements

Creating and using any HTML element is very easy. Following example creates an input and a button element.

$input = ElementFactory::createInput();
$input->setType('text');
$divIndent->addChild($input);
 
$btn = ElementFactory::createButton('This is a button');
$divIndent->addChild($btn);

Adding attributes to elements

The framework allows to add any attribute to any element. The example below adds the checked attribute to an input element.

$chb = ElementFactory::createInput();
$chb->setType('checkbox');
$chb->setAttribute('checked', true); // or use $chb->setChecked(true);

Changing element attributes

Changing any attribute of any element is also supported. The following example changes readonly attribute of an input element.

public function onClickChangeReadonly(ClickEvent $event) {
    $c = $this->getAttachedElementById('inputReadonly');
    $c->setAttribute('readOnly', false);
}

Also all elements can be configured to have their attributes and properties synchronized between client and server. The next example demonstrates this using a checkbox. The checked property in the server is being updated by the client automatically for the input element.

public function onClickToggleChecked(ClickEvent $event) {
    $c = $this->getAttachedElementById('checkboxChecked');
    $c->setChecked(!$c->isChecked());
}