[[PageOutline()]] = Welcome to ef = ef stands for '''E'''xecution '''F'''ramework and it is a single PHP file which lets you to write modular web applications in a new, experimental way. * [http://git.asn.pl/?p=pjf/ef.git;a=summary git repository] * [http://labs.asn.pl/docs/pjf/ef/ef_8php.html Doxygen API documentation] = Introduction = The original motivation (dating 2004) behind the project was an observation that dynamic web sites are often just proxies to underlying modules. Their task is to translate users URL request into a bunch of subrequests and position obtained HTML responses on a web page. For example, main page of a portal site may consist of a search module, news listing and view of latest forum postings. Goal of this project is to make modules written in ef request-oriented and so flexible and independent, that they may be transferred between completely different web sites. Second observation was that URLs close to each other (in terms of time and functionality) often share same "computations" made at the beginning of request handling phase. For example, actions of creating and editing a site user follow the same code path of creating a suitable HTML form; first action will stop here, and second will fill the form with actual data. Thus, goal of ef is to resemble this in modules file structure. == Features == * breaks code into multiple files and directories responsible for different functionality * simple PHP-based templates * simple support for internationalization * complete separation of computation from presentation = The idea = ef handles requests. A request consists of path and parameters, very similar to what a web browser does. In order to handle the request, ef is given a "module root" directory (similar to HTTP servers docroot) with module implementations. ef traverses file system according to requested path. For example, if /var/ef is module root and /forum/user/edit path is requested, ef will start at /var/ef/forum, then cd into /var/ef/forum/user and finally /var/ef/forum/user/edit. In each directory visited, ef executes file named action.php, if its present. This file is responsible for doing all computations needed at this level, exporting template variables and returning an exit code. Basing on this code, ef continues, stops at this level (with success) or aborts request at all. During this traversal ef registers the template structure for later usage. Once the path end is reached, an object holding all exported variables and template structure is returned. The data may be further "poured" into HTML templates or directly exported in JSON format. == Simple example == Suppose you have following file structure: * htdocs/index.php - so called "interface" * ef.php - ef source code * myapp/ - exemplary application * myapp/action.php * myapp/foo/action.php * myapp/block-main.php * myapp/lang.pl.php === htdocs/index.php === {{{ "hello world")); ?> Hi there Output of myapp1: Output of myapp2: }}} === myapp/action.php and myapp/foo/action.php === {{{ -- myvar = , myarg = }}} === myapp/lang.pl.php === {{{ "Cześć!"); }}} === Output === {{{ Hi there Output of myapp1: Hi there! -- myvar = level 1, myarg = Output of myapp2: Hi there! -- myvar = level 1 and level 2, myarg = hello world }}}