File: src/View/View.php

Recommend this page to a friend!
  Classes of Thierry Feuzeu  >  Jaxon Sentry  >  src/View/View.php  >  Download  
File: src/View/View.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon Sentry
Common classes for Jaxon based Ajax applications
Author: By
Last change: Apply fixes from StyleCI
Date: 3 years ago
Size: 1,427 bytes
 

 

Contents

Class file image Download
<?php

namespace Jaxon\Sentry\View;

use
Jaxon\Sentry\Interfaces\View as ViewInterface;

class
View implements ViewInterface
{
   
/**
     * Add a namespace to this view renderer
     *
     * @param string $sNamespace The namespace name
     * @param string $sDirectory The namespace directory
     * @param string $sExtension The extension to append to template names
     *
     * @return void
     */
   
public function addNamespace($sNamespace, $sDirectory, $sExtension = '')
    {
       
// This method is provided by the Template trait
       
if(($sDirectory))
        {
           
jaxon()->addViewNamespace($sNamespace, $sDirectory, $sExtension);
        }
    }

   
/**
     * Render a view
     *
     * @param Store $store A store populated with the view data
     *
     * @return string The string representation of the view
     */
   
public function render(Store $store)
    {
       
$sViewName = $store->getViewName();
       
$sNamespace = $store->getNamespace();
       
// In this view renderer, the namespace must always be prepended to the view name.
       
if(substr($sViewName, 0, strlen($sNamespace) + 2) != $sNamespace . '::')
        {
           
$sViewName = $sNamespace . '::' . $sViewName;
        }
       
// Render the template
       
return trim(jaxon()->render($sViewName, $store->getViewData()), " \t\n");
    }
}


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