\CodeIgniter\ViewCell

Class Cell

A simple class that can call any other class that can be loaded, and echo out it's result. Intended for displaying small blocks of content within views that can be managed by other libraries and not require they are loaded within controller.

Used with the helper function, it's use will look like:

    viewCell('\Some\Class::method', 'limit=5 sort=asc', 60, 'cache-name');

Parameters are matched up with the callback method's arguments of the same name:

    class Class {
        function method($limit, $sort)
    }

Alternatively, the params will be passed into the callback method as a simple array if matching params are not found.

    class Class {
        function method(array $params=null)
    }

Summary

Methods
Properties
Constants
__construct()
render()
prepareParams()
No public properties found
No constants found
determineClass()
$cache
N/A
No private methods found
No private properties found
N/A

Properties

Methods

render()

render(string  $library, null  $params = null, integer  $ttl, string|null  $cacheName = null) : string

Render a cell, returning its body as a string.

Parameters

string $library
null $params
integer $ttl
string|null $cacheName

Throws

\ReflectionException

Returns

string

prepareParams()

prepareParams(  $params) : array|null

Parses the params attribute. If an array, returns untouched.

If a string, it should be in the format "key1=value key2=value". It will be split and returned as an array.

Parameters

$params

Returns

array|null

determineClass()

determineClass(string  $library) : array

Given the library string, attempts to determine the class and method to call.

Parameters

string $library

Returns

array