PHP Classes
elePHPant
Icontem

File: myEngine/sample.php

Recommend this page to a friend!
  Classes of Tereshchenko Andrey  >  myEngine  >  myEngine/sample.php  >  Download  
File: myEngine/sample.php
Role: Example script
Content type: text/plain
Description: Example
Class: myEngine
Illustration of use XML/XSLT technology with PHP.
Author: By
Last change: -
Date: 16 years ago
Size: 1,090 bytes
 

 

Contents

Class file image Download
<?php

function getmicrotime() {
   list(
$usec, $sec) = explode(" ", microtime());
   return ((float)
$usec + (float)$sec);
}
$time_start = getmicrotime();

$root = $_SERVER['DOCUMENT_ROOT'];
$path1 = $root.'/myXML;';
$path2 = $root.'/PEAR;';
$searchPath = $path1.$path2;
ini_set('include_path', $searchPath);

require_once(
'myEngine.php');

$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_TRIGGER;
$GLOBALS['_PEAR_default_error_options'] = E_USER_WARNING;
$GLOBALS['_myEngine_xslt_translation'] = true;
//Enable for create file debug.xml with xml before translating.
$GLOBALS['_myEngine_debug_xml'] = true;

$page = 'sample.xml';

define('SAMPLE_TEXT', 'This text added in xsl stylesheet through processing instruction');

$result = myEngine::init();
PEAR::isError($result) and
   
trigger_error($result->getMessage(), E_USER_ERROR);

$result = myEngine::open($page);
PEAR::isError($result) and
   
trigger_error($result->getMessage(), E_USER_ERROR);

$time_end = getmicrotime();
$time = $time_end - $time_start;
print(
"<br>Time: $time s.");

?>