Example #1
0
$raiz = isset($raiz) ? $raiz : "../../../";
require_once $raiz . 'librerias/iMobile/Configuracion.cnf.php';
/**
 * Example 2 - Adding Pages
 * @package iMobile
 * @filesource
 */
/**
 * Create a new Php object.
 */
$j = new Container();
/**
 * Create a new Page object and populate it
 */
$p = new Page('example-2');
$p->theme('b');
$p->title('Example 2');
$p->header()->addButton('Example 1', 'example-1.php', 'a', 'arrow-l');
$p->header()->addButton('Example 3', 'example-3.php', 'b', 'arrow-r');
$p->header()->theme('a');
$p->addContent('<h1>Adding Pages</h1>');
$p->addContent('<p>In this example we create a Page,');
$p->addContent(' add content and Buttons to the Header.');
$p->addContent(' After we add the page to Container object.</p>');
$p->addContent('<a href="index.php" data-role="button" data-theme="a">Home</a>');
$p->addContent('<a href="example-3.php" data-role="button">Example 3</a>');
$p->footer()->title('Example 2 Footer');
$p->footer()->position('fixed');
$p->footer()->theme('a');
/**
 * Add the page to Container object.
Example #2
0
ini_set('display_errors', '1');
$raiz = isset($raiz) ? $raiz : "../../../";
require_once $raiz . 'librerias/iMobile/Configuracion.cnf.php';
/**
 * Create a new Php object.
 */
$j = new Container();
/**
 * Config 'html' and 'head' tag.
 */
$j->head()->title('Example 4');
/**
 * Create and config a page object.
 */
$p = new Page('example-4');
$p->theme('b')->title('Example 4');
$p->header()->theme('a')->add(new Button('', array(new Attribute('data-iconpos', 'notext')), array(), 'a', 'index.php', '', 'home'));
/**
 * Create and config a new navbar object and add items.
 */
$nav = $p->header()->add(new Navbar(), true);
$nav->add(new Button('', array(), array(), 'a', 'example-1.php', 'EX1', '', false));
$nav->add(new Button('', array(), array(), 'a', 'example-2.php', 'Ex2', '', false));
$nav->add(new Button('', array(), array(), 'a', 'example-3.php', 'EX3', '', false));
$nav->add(new Button('', array(), array(), 'a', '#', 'EX4', '', true));
$nav->add(new Button('', array(), array(), 'a', 'example-5.php', 'EX5', '', false));
/**
 * Configure page footer (Footer).
 */
$p->footer()->addButton('EX1', 'example-1.php', '', 'arrow-l');
$p->footer()->addButton('EX2', 'example-2.php', '', 'arrow-l');
Example #3
0
$j->head()->title('Example 3');
$j->head()->css('http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css');
$j->head()->jq('http://code.jquery.com/jquery-1.4.4.min.js');
$j->head()->jqm('http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js');
$j->head()->add(new Link('css/custom.css'));
// Adding a custom CSS.
$j->head()->add(new Script('js/custom.js'));
// Adding a custom JavaScript.
//$j->body()->attribute('onload', 'initCustom();');     // Adding a custom attribute to 'body' tag.
/**
 * Create and config a page object.
 * Most methods return the object itself allowing call
 * another method on the object in sequence.
 */
$p = new Page('example-3');
$p->theme('b')->title('Example 3')->header()->addButton('Example 2', 'example-2.php', 'a', 'arrow-l')->addButton('Example 4', 'example-4.php', 'b', 'arrow-r')->theme('a');
/**
 * addContent() is alias to content()->add().
 */
$p->content()->add('<h1>Adding Objects</h1>');
$p->addContent('<h3>Controlgroup and Buttons</h3>');
/**
 * Create and config a new controlgroup object and add items.
 * Most methods of addition have the last parameter $returnAdded.
 * If it is set to 'true' the added object is returned, otherwise
 * the object that called the method is returned.
 */
$cg = $p->content()->add(new Controlgroup(), true);
$cg->dataType('vertical');
$cg->add(new Button('', array(), array(), 'a', 'index.php', 'Home', 'home', false));
$cg->add(new Button('', array(), array(), 'b', 'example-1.php', 'Example 1', 'arrow-l', false));