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: 10 years ago
Size: 1,648 bytes


Class file image Download

 * MyProjectNameHere <>
 * 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 <>
 * @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

        <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>
// This loads content based on currently active translation from a file in /resources/contents/ folder
echo $this->getContent('example');

// API Will load result data from output buffer
return null;