PHP Classes

File: class_cmenu_test.php

Recommend this page to a friend!
  Classes of phvandenberghe  >  PHP Menu Builder Class  >  class_cmenu_test.php  >  Download  
File: class_cmenu_test.php
Role: Example script
Content type: text/plain
Description: Test sample for cMenu
Class: PHP Menu Builder Class
Create nested menus using HTML link tags
Author: By
Last change: Minor corrections
Date: 2 years ago
Size: 1,025 bytes
 

Contents

Class file image Download
<?php

include 'class_cmenu.php';

echo
'<h2>Test 1</h2>';

$items = array();
$items[] = new cMenu( 'page-1', 'id=page-1|href=page-1.html' );
$items[] = new cMenu( 'page-2', 'id=page-2|href=page-2.html' );
$items[] = new cMenu( 'page-3', 'id=page-3|href=page-3.html' );
$m = new cMenu( $items, 'id=item-1|class=item-menu' );

echo
$m->output('page-2', 'tag=span' );

echo
'<h2>Test 2</h2>';

$items = array();
$items[] = new cMenu( new cMenu ('page-1', 'id=page-1|href=page-1.html'), 'id=item-1' );
$items[] = new cMenu( new cMenu ('page-2', 'id=page-2|href=page-2.html'), 'id=item-2' );
$items[] = new cMenu( new cMenu ('page-3', 'id=page-3|href=page-3.html'), 'id=item-3' );
$m = new cMenu( $items, 'id=group-1|class=group-menu' );
$m->addInnersAttr( 'class=item-menu' );
$m = new cMenu( $m, 'id=main-menu' );

echo
$m->output('page-2', 'tag=span', 'addclass=active', 1 );

echo
'<h2>Test 3 - access to attributes</h2>';

var_dump($m->inner[0]->inner[0]);
var_dump($m->inner[0]->outer['href']);

For more information send a message to info at phpclasses dot org.