- <?php
- // Single Array Complex Example
- $plugins['hello_world'] = array(
- 'pages' => array(
- 'General Greeting' => array(
- 'route' => array(
- '/hello' => 'pageHelloComplex'
- ),
- 'permissions' => array(
- 'View Greeting' => true
- ),
- ),
- ),
- 'blocks' => array(
- 'Specific Greeting' => array(
- 'route' => 'blockHelloComplex',
- 'permissions' => array(
- 'View Block' => true
- ),
- ),
- ),
- );
- function pageHelloComplex()
- {
- $body = new Template("general_greeting.tpl.php");
- }
- // Contents of 'general_greeting.tpl.php' -
- // <h1>Hello World!</h1>
- // Output:
- // Hello World!
- function blockHelloComplex()
- {
- $body = new Template("specific_greeting.tpl.php");
- }
- // Contents of 'specific_greeting.tpl.php' -
- // <h1>Hello John!</h1>
- // Output:
- // Hello John!
- // Let's look at the resulting array
- echo "<br />This is an example of the complex way to build the array: <br />";
- echo "<pre>";
- echo print_r($plugins);
- echo "</pre>";
Single Array Complex Example