Login   Register  
PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrea Tosone  >  PHPPolygen  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: example uses
Class: PHPPolygen
Generate phrases based on a grammar using Polygen
Author: By
Last change: Version 1.1 - fixes for the restored site
Date: 2009-04-24 00:50
Size: 1,043 bytes
 

Contents

Class file image Download
<?

    
/**
     * PHPPolygen - file di esempio
     * PHPPolygen - example program
     *
     * @package PHPPolygen
     * @author InuYaksa
     * @version 1.1
   * @copyright 2008-2009 InuYaksa
     * @link http://www.areaaperta.com
     */     
     
  
require('phppolygen.php');  //** includi la classe - include class file

    
$gram 'eng/artex.grm';  //** Seleziona la grammatica - Select the grammar class
    
//    $gram = 'ita/unieuro.grm';    //** consigliatissima, molto divertente!
    
    
$poly = new PHPPolygen($gram);  //** istanza l'oggetto e indica la grammatica - istance object selecting grammar
    
    
$ok $poly->generate();  //** richiama Polygen - make a Polygen request
                              //** viene TRUE o FALSE - return TRUE or FALSE
    
    
if ($ok) {  //** tutto ok? - does it work?
      
echo $poly->getHTML();  //** visualizza la frase in HTML - show text as HTML output
    
} else {
      echo 
'Errore da Polygen: '.$poly->getError();  //** visualizza l'errore - display error
    
}
    
    echo 
'<BR />';
    
    echo 
$poly->getPolygenLink();    
?>