PHP Classes

File: example_simple.php

Recommend this page to a friend!
  Classes of Rubens Takiguti Ribeiro   Hierarchy   example_simple.php   Download  
File: example_simple.php
Role: Example script
Content type: text/plain
Description: Simple Example
Class: Hierarchy
Display lists of nested arrays
Author: By
Last change:
Date: 16 years ago
Size: 996 bytes
 

Contents

Class file image Download
<?php

require_once(dirname(__FILE__).'/hierarchy.class.php');

// Create an array of item hierarchicaly
$list = array(
   
'a' => array(
       
'b' => false,
       
'c' => false,
       
'd' => false),
   
'e' => array(
       
'f' => false,
       
'g' => false,
       
'h' => array(
           
'i' => false,
           
'j' => false,
           
'k' => false,
        ),
       
'l' => false
   
)
);

$list_hierarchicaly = hierarchy::print_list($list);

header('Content-type: text/html; charset=UTF-8');
echo <<<HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<title>Example</title>
<link rel="stylesheet" type="text/css" media="all" href="hierarchy.css.php" />
</head>
<body>
<h1>Simple List</h1>
<div style="border: 1px solid red; padding: 0 1em;">
{$list_hierarchicaly}
</div>
<p>You can print a list hierarchicaly.</p>
</body>
</html>
HTML;