Skip to content

Template

Khen Solomon Lethil edited this page Jul 9, 2016 · 6 revisions

if the given array value is array, then the key is expected to a template file

<?php
namespace app\map;
class home extends mapController
{
    public function __construct()
    {
        /*
        constructor
        */
    }
    public function home()
    {
        return array(
            'home'=>array(
                'page.id'=>'home',
                'page.class'=>'home',
                'Title'=>'Title is replaced',
                'Description'=>'Description is replaced',
                'Keywords'=>'PHP framework',
                'home.li'=>array(
                    'home.li.one'=>'One of One',
                    'home.li.two'=>'One of Two',
                    'home.li.li'=>array(
                        'home.li.li.one'=>'Two of One',
                        'home.li.li.two'=>'Two of Two',
                    )
                ),
                'home.loop'=>array(
                    array(
                        'loop.one'=>'Loop One of One',
                        'loop.two'=>'Loop One of Two',
                    ),
                    array(
                        'loop.one'=>'Loop Two of One',
                        'loop.two'=>'Loop Two of Two',
                    ),
                    array(
                        'loop.one'=>'Loop Two of One',
                        'loop.two'=>'last',
                    )
                )
            )
        );
    }
    public function basic_example()
    {
        return array(
            'home'=>array(
                'page.id'=>'home',
                'page.class'=>'home',
                'Title'=>'Title is replaced',
                'Description'=>'Description is replaced',
                'Keywords'=>'PHP framework',
                'Content'=>'Hello World!'
            )
        );
    }
    public function template_looping_example()
    {
        return array(
            'home'=>array(
                'loop'=>array(
                    array(
                        'loop.one'=>'Loop One of One',
                        'loop.two'=>'Loop One of Two',
                    ),
                    array(
                        'loop.one'=>'Loop Two of One',
                        'loop.two'=>'Loop Two of Two',
                    ),
                    array(
                        'loop.one'=>'Loop Two of One',
                        'loop.two'=>'last',
                    )
                )
            )
        );
    }
}

Clone this wiki locally