PHP Classes

File: views/view.home.php

Recommend this page to a friend!
  Classes of Kristo Vaher  >  Wave Framework  >  views/view.home.php  >  Download  
File: views/view.home.php
Role: Class source
Content type: text/plain
Description: Home View
Class: Wave Framework
MVC framework for building Web sites and APIs
Author: By
Last change: Added subkeyword parameter to getTranslations() method in case translations are grouped in translations files. Added getContent() method that can be used to load static language-based HTML within Views from /resources/content/ folder and subfolders. Added 'server-name' and 'server-port' State variables.
Date: 8 years ago
Size: 1,648 bytes
 

Contents

Class file image Download
<?php

/**
 * MyProjectNameHere <http://www.example.com>
 * Home View
 *
 * This view is loaded when WWW_controller_view finds root or home page as the view file. Name
 * of the 'home' view is defined as a default in WWW_State class. This home view example also
 * shows how to use translations.
 *
 * @package Factory
 * @author DeveloperNameHere <email@example.com>
 * @copyright Copyright (c) 2012, ProjectOwnerNameHere
 * @license Unrestricted
 * @tutorial /doc/pages/guide_mvc.htm
 * @since 1.0.0
 * @version 1.0.0
 */

class WWW_view_home extends WWW_Factory {

   
/**
     * View Controller calls this function as output for page content.
     *
     * This method returns null by default because the API will load the
     * result from output buffer, if the API call echoes/prints any output.
     * It is recommended for View methods not to return any variable data.
     *
     * @param array $input input array from View Controller
     * @return null
     */
   
public function render($input){
       
       
// Translations are stored in input variables and can be used within the view
       
$translations=$this->getTranslations();
       
       
?>

        <div style="text-align:center;padding:30px;">
            <!-- Simple translation is echoed to show how the translations can be used -->
            <h1 style="font:30px Tahoma; color:#3e445a;padding:30px;text-align:center;"><?=$translations['hello-world']?></h1>
            <?php
               
// This loads content based on currently active translation from a file in /resources/contents/ folder
               
echo $this->getContent('example');
           
?>
</div>

        <?php
       
       
// API Will load result data from output buffer
       
return null;
       
    }

}
   
?>

For more information send a message to info at phpclasses dot org.