2017 © Pedro Peláez
 

library render

Renderers for links, tables, pages

image

anishmm/render

Renderers for links, tables, pages

  • Friday, June 2, 2017
  • by anishmathew
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Render

Creating renderers for render arrays of type link, table, basic page with title, body and tags, etc., (*1)

RENDER ARRAY EXAMPLES

EXAMPLE RENDER ARRAY FOR A TABLE

$table = array(
    'type' => 'table',

    // list of table headers
    // an array of strings
    'headers' => array(
        'col_name_1',
        'col_name_2',
        'col_name_3',
        ...
    ),

    // an array of arrays representing rows
    // render arrays for tables or links
    'rows' => array(

        // a row may be array of strings
        array(
            'row_1_cell_1',
            'row_1_cell_2',
            ...
        ),

        // a row may be array of render arrays for links and tables
        array(
            $render_array_for_link,
            $render_array_for_table,
            ...
        ),

        // a row may be an array of both render arrays and strings 
        array(
            $render_array_for_link,
            'row_2_cell_2',
            $render_array_for_table,
            ...
        ),
        ...
    ),
);

Notes

For a table, number of headers in taken as number of columns, and if a row contains more cell values, the excess ones at the end are discarded., (*2)


$link = array(
    'type' => 'link',

    //string containing the url to be linked
    'url' => $url_to_my_page,

    //string containing the link text
    'text' => $link_text,
);

Notes

Link text by default is 'Click Here'., (*3)


EXAMPLE RENDER ARRAY FOR A PAGE

$page = array(
    'type' => 'page',

    //string containing title of page
    'title' => $title_for_my_page,

    //string OR render array for link or table OR
    // array of strings and render arrays for links and tables
    'body' => array(
        $render_array_for_table,
        $render_array_for_link,
        "this is an example",
        ...
    ),

    //array of link render arrays
    'tags' => array(
        $tag_1_link,
        $tag_2_link,
        $tag_3_link,
        ...
    ),
);

Notes

Tags are optional for a page., (*4)


The Versions

02/06 2017

dev-master

9999999-dev https://github.com/anish-mm/Render

Renderers for links, tables, pages

  Sources   Download

The Requires

  • php ^5.3.3 || ^7.0

 

by Anish M M