Login   Register  
PHP Classes
elePHPant
Icontem

File: grammar_test1_php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mark Headd  >  PHP Grammar  >  grammar_test1_php  >  Download  
File: grammar_test1_php
Role: Example script
Content type: text/plain
Description: Simple grammar example
Class: PHP Grammar
Create speech recognition grammar W3C XML files
Author: By
Last change:
Date: 2004-10-03 20:45
Size: 647 bytes
 

Contents

Class file image Download
<?php 

// Set MIME type for XML grammar fomat
header('Content-type: application/grammar+xml');

//Include base class
require ('grammar.php');

/*
This example makes calls to methods in the base grammar class to create a simple XML grammar file
*/

// Create new grammar object and call appropriate methods from base class
$page = new grammar;
$page->gramStart();
$page->ruleStart();
$page->oneOfstart();
$page->itemStart();
echo 
"one";
$page->itemEnd();
$page->itemStart();
echo 
"two";
$page->itemEnd();
$page->itemStart();
echo 
"three";
$page->itemEnd();
$page->oneOfend();
$page->ruleEnd();
$page->gramEnd();

?>