Login   Register  
PHP Classes
elePHPant
Icontem

File: JUI/Jui.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jakub Kuritka  >  PHP JUI templating system  >  JUI/Jui.php  >  Download  
File: JUI/Jui.php
Role: Auxiliary script
Content type: text/plain
Description: Application script
Class: PHP JUI templating system
Build HTML user interfaces from JSON definitions
Author: By
Last change: Now we are using YAML instead of JSON, but JSON serializer still exists, so it can be used
Date: 2 years ago
Size: 1,242 bytes
 

Contents

Class file image Download
<?php

/**
 * @author Jakub Kuritka <jakub.kuritka@outlook.com>
 * @copyright (c) 2012, Jakub Kuritka
 * @license LGPL
 */


define("JUI_DIR"dirname(__FILE__));
define("JUI_RESOURCES_FILE"dirname(dirname(__FILE__)) . "/Resources/resources.yaml");

/* 
 * Set it true while developing, otherwise set false, 
 * because autoloader will generate class map everytime you run your appliaction
 */
define("JUI_REGENERATE_CLASS_MAP"true);

/*
 * If you have your own autoloader, comment this line
 */
require_once JUI_DIR "/Autoloader/OPLAutoloader.php";

/*
 * Create parser and Serializer
 * Visit JUI/Engine/Serializers dir for more serializers
 */
$serializer = new \JUI\Engine\Serializers\Yaml();

$parser = new \JUI\Engine\Parser();
$parser->setSerializer($serializer);

/*
 * Create resources
 */
$resources  = new \JUI\Resources();
$resources->setParser($parser); //for components parsing
$resources->setSerializer($serializer); //for reading resources file
$resources->setFile(JUI_RESOURCES_FILE);//it will set file and automatically parse, so you have to set parser before calling this method.

/*
 * Every component can acess resources calling $this->resources() method
 */
\JUI\Components\Component::setResources($resources);

?>