Skip to content
bbh edited this page Nov 7, 2011 · 10 revisions

Welcome to the tlalokes wiki!

Table of Contents

Installation

Requirements

  • PHP 5.3.x
  • If you need database connections: PDO binary extension installed (native driver recommended)
  • If you require CLI execution: PHP CLI mode enabled
  • If you require web server we recomment Apache 2.x or Nginx

Structure

When you check into the Tlalokes, you will see two directories:

  • framework. This directory contains the frameworks required files.
  • example. This directory contains an example of the structure required to use the framework.
    • htdocs. This directory contains the files to be exposed on the Web and the required file to load your application throw the framework.
    • application. This directory contains the structure of your application.
      • controller. Contains the classes used as controllers.
      • model. Contains the files used as models.
        • business. Contains the files where the business logic must be allocated.
      • view. Contains the views files and structure.
        • layout. Contains the layouts files used to display a view
        • block. Contains the blocks for the layouts.
      • _misc.
        • locale.
        • lib.
        • sql.
        • tmp.

Configuration

config.php

 <?php
 $c = array();
 // Default
 $c['default']['controller'] = 'example';
 $c['default']['locale'] = 'eng';
 $c['default']['charset'] = 'utf8';
 $c['default']['timezone'] = 'America/Monterrey';
 // DSN
 $c['dsn']['default']['type'] = 'mysql';
 $c['dsn']['default']['host'] = 'localhost';
 $c['dsn']['default']['name'] = 'tlalokes_test';
 $c['dsn']['default']['username'] = 'root';
 $c['dsn']['default']['password'] = '';

Controller

ExampleCtl.php

  /**
   * Action displays Hello World in a Template based View
   *
   * @Action( file='example_hello' )
   */
  public function helloWorld ()
  {
   tf_response_set( 'hello_world', 'Hello World' );
  }
 
  /**
   * Actions displays data from an example database in a Layout based View
   *
   * @Action( layout='example', zone='content:data' )
   */
  public function getDataFromDB ( )
  {
   require 'ExampleBss.php';
 
   tf_response_set( 'example', ExampleBss::getData() );
  }
 
  /**
   * A simple sum without View layer
   */
  public function sumThis ()
  {
    echo tf_request('val1') + tf_request('val2');
  }
 }

Model

Business

ExampleBss.php

 <?php
 class ExampleBss {
  public static function getData ()
  {
    $db = tf_db( 'default' );
    if ( $db ) {
      $result = $db->query( 'SELECT * FROM example', true, true );
      return $result;
    }
  }
 }

View

Template

Layout

Block

Miscelaneous

Locale

Libraries

SQL

Temp