Thule - 0.9.6
  • Welcome
  • Introduction
  • - MVC(Model-View-Controller)
    - Architecture of Framework
    - Flow Chart of Application
    - Services In One Server
    - Developing Guide
    - Features
  • Installation
  • Getting Started
  • - Direct Access HTTP
    - Router Access HTTP
    - Router Direct Access HTTP
    - Reserved Function
    - Convention
    - Bootstrap
    - Pack Javascript , CSS
  • Basic Modules
  • - Model
    - View
    - Controller
  • Libraries
  • - Router
    - Config
    - Response
    - Request
    - Database
    - Query
    - Cache
    - Debug
    - Log
    - Unit Test
    - Registry
    - Profile
  • Helper
  • - Auth
    - Calendar
    - Date
    - Error page
    - Email
    - Form
    - GeoIP
    - Google
    - Html Element
    - Html
    - Http
    - I18n
    - Image
    - Json
    - Jquery
    - Login
    - Layout
    - Locale
    - PHP to Javascript
    - Paging
    - Payflow
    - Soap
    - Text
    - Table
    - Uri
    - Upload
    - Validation
  • Plugins
  • - Smarty Template Engine
  • History
  • Home > View

    There are 4 types of view none-router-with-template , none-router-without-template, router-with-template,router-without-template.

    Direct Access without-template

    It doesn't need the controller just same as pure php without framework such as rule of HTTP.

    <?php ${'controller.action'}=array('controller.action'=>'vm.f1','template'=>FALSE);
    include_once($_SERVER['DOCUMENT_ROOT']."/gate.php"); ?>
    <?php var_dump($RESPONSE); ?>
    <html>
    <head>
    <title> Welcome To special Blog</title>
    </head>
    <body>
    <p>Welcome to Thule Framework!</p>
    </body>
    </html>

    Direct Access with-template

    Same as none-router-without-template except template.
    Smarty Template Engine is built in, If you want to use,just do.

    <?php ${'controller.action'}=array('controller.action'=>'vm.f1','template'=>TRUE);
    include_once($_SERVER['DOCUMENT_ROOT']."/gate.php"); ?>
    <{debug}> // this is an option for debugging.
    <{$vm.variables }>
    <html>
    <head>
    <title> <{$vm.title}> </title>
    </head>
    <body>
    <p>Hello <{$vm.thulename}>!</p>
    </body>
    </html>

    Router Access without-template

    Same to other framework.

    <html>
    <head>
    <title> <?php echo $title; ?> </title>
    </head>
    <body>
    <p>Hello <?php echo $thulename; ?>!</p>
    </body>
    </html>

    Router Access with-template

    Same to other framework.

    <html>
    <head>
    <title> <{ $title; }> </title>
    </head>
    <body>
    <p>Hello <{ $thulename; }>!</p>
    </body>
    </html>

    Router Direct Access Without-template

    <?php echo $Frontend->load("controller.action"); ?>
    <html>
    <head>
    <title> <?php echo $title; ?> </title>
    </head>
    <body>
    <p>Hello <?php echo $thulename; ?>!</p>
    </body>
    </html>

    The Controller is consisted of HTTP layer controller and view layer controller.
    First one handles about HTTP like a routing and second manages view layer because of view can be made up several feature you want.

    Ususally, the controller executes the binding of request and response to view with or without template engine.

    Frontend Dispatcher

    Frontend Dispatcher helps a frontend developer to implement view.

    Change Frontend Controller Name in Views

    If you don't want the name of Frontend Contorller to be "Frontend", you can change very easily like below in config/thulef.php

    global $FrontendDispatcher;
    $FrontendDispatcher="FE";
    new Thule_ViewDispatcher(${'controller.action'});

    in views
    <?php echo $FE->debug(); ?>

    Debug

    Debug is very useful to frontender because frontender can see the request,response and cache with popup.

    <?php echo $Frontend->debug();?>
    <?php echo $Frontend->debug('include/debugpopup.html');?>

    default paging design file : include/paging.html


    <?php echo $Frontend->paging($PAGING["VM"]); ?>

    Css configure : config/dev_config.php


    //css include
    $config['frontend_css_file']="include/css.php";
    //css path
    $config['frontend_css_path']="css";

    In Views

    <?php echo $Frontend->css('css'); ?>
    <?php echo $Frontend->css(array('css','css1',,)); ?>
    default css html file : include/css.php
    default css path : /css

    <?php echo $Frontend->css(array('css','css1',,),'css1','include/css1.php'); ?>
    css html file : include/css1.php
    css path : /css1

    Jaavscript configure : config/dev_config.php


    //javascript path
    $config['frontend_javascript_path']="js";
    //javascript include
    $config['frontend_javascript_file']="include/javascript.php";

    In Views

    <?php echo $Frontend->javascript('javascript'); ?>
    <?php echo $Frontend->javascript(array('javascript','javacript1',,,)); ?>
    default javascript html file : include/javascript.php
    default javascript path : /js

    <?php echo $Frontend->javascript(array('javascript','javacript1',,,),'js1','include/javascript1.php'); ?>
    default javascript html file : include/javascript1.php
    default javascript path : /js1

    Highlighting

    <?php echo $Frontend->highlight("hello thule, this is thule im thulerealythulebyebye","thule"); ?>

    <?php echo $Frontend->highlight("hello thule, this is thule im thulerealythulebyebye","thule",array('st'=>'<b>','et'=>'</b>')); ?>

    Calendar configure : config/dev_config.php


    //calendar design
    $config['frontend_calendar_file']="include/calendar.html";

    Calendar

    <?php echo $Frontend->calendar(8,2008);?>

    <?php echo $Frontend->calendar(8,2008,"include/calendar1.html");?>

    <?php echo $Frontend->calendar();?>

    Character Set

    <?php echo $Frontend->charset();?>
    //<meta http-equiv="Content-type" content="text/html" charset="utf-8" />
    <?php echo $Frontend->calendar('ISO-xxx');?>
    //<meta http-equiv="Content-type" content="text/html" charset="ISO-xxx" />

    load controller

    <?php $Frontend->load("Controller.Action");?>
    or
    <?php $Frontend->load(array("Controller.Action","controller1.Action");?>

    load Helper

    <?php $Frontend->loadHelper("text");?>

    Redirect

    <?php $Frontend->redirect($url);?>

    Navigator for each page

    // http://domain/forum/post/xx

    <?php $navigator=$Frontend->navigator()?>
    $navigator="fourm"
    <?php $navigator=$Frontend->navigator(1)?>
    $navigator="post"

    Include

    This include function is very useful to include the view file in view. The root path will be views root path so if you want to have "/views/member/m.php" you need to call like below.

    The extension ".php" already predefined in configure doesn't need to put.

    $Frontend->inc("member/m");

    Layout

    This feature will be best feature to create view file repeatedly should include header and footer

    If you want to use the layout , you can call like below and it must be FRONT OF ANY LOAD FUNTCION.

    This means you call the default layout defined in configure which is "layouts/layout.php"

    $Frontend->layout();

    If you want to make your own layout, you can call like below except the extension.

    $Frontend->layout("your-own-layout");

    Pass the value to action

    Sometimes you should pass the value to action in view files.

    $Frontend->load(array("controller.action"=>"pass-this-value");