<nephtali>

A simple, flexible, fast, and security-focused PHP framework
Nephtali documentation

API documentation

n\view

Function(s) for working with pipe views.

Functions

  • string databind($markup , array $rows, array $opts)

    Databinds rows of associative arrays to the markup contained within the <!--data--> region of the pipe markup.

    The $opts argument provides you with several rendering options, all of which are displayed in the example $opts array below:

    $opts = array(
    // allow italics tags to pass through the encoding for the title field
    'whitelists' => array('title' => array('<i>','</i>')),
    
    // display rating optblock when rating field is not empty
    'optblocks' => array('rating' => function($row){ if (strlen($row['rating'])) return true; return false; }),
    
    // set databinding to "placeholder" (default) or "form", which binds data by matching array keys to form field names
    'databinding' => 'form',
    
    // set charset used for databinding purposes
      'charset' = > 'UTF-8'
    );
    

  • string render(string $name, string $markup, array $rows, array $opts)

    Returns view markup after any required databinding.

    The $opts argument provides you with several rendering options, all of which are displayed in the example $opts array below:

    $opts = array(
    // allow italics tags to pass through the encoding for the title field
    'whitelists' => array('title' => array('<i>','</i>')),
    
    // display rating optblock when rating field is not empty
    'optblocks' => array('rating' => function($row){ if (strlen($row['rating'])) return true; return false; }),
    
    // set databinding to "placeholder" (default) or "form", which binds data by matching array keys to form field names
    'databinding' => 'form',
    
    // set charset used for databinding purposes
      'charset' = > 'UTF-8'
    );
    

Nephtali namespaces