Login   Register  
PHP Classes
elePHPant
Icontem

File: listxbel.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Bas Burger  >  expatXBEL  >  listxbel.php  >  Download  
File: listxbel.php
Role: ???
Content type: text/plain
Description: example uses expatXBEL.php
Class: expatXBEL
A simple expat based XBEL-file parser
Author: By
Last change:
Date: 12 years ago
Size: 3,275 bytes
 

Contents

Class file image Download
<?php

require 'expatXBEL.php';
	 
$xbelfile = 'example-xbel.xml';
$xbel = new expatXBEL($xbelfile);
	 
echo "
	 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
	 <html>
	 <head>
	 <title>XBEL Script</title>
	 <style>
	 body ,td {
	   scrollbar-3d-light-color : #FFFFFF;
	   scrollbar-arrow-color : #7B5584;
	   scrollbar-track-color : #DEDFBD;
	   scrollbar-base-color : #DEDFBD;
	   scrollbar-dark-shadow-color : #C0C0C0;
	   scrollbar-face-color : #C6BA9C;
	   scrollbar-highlight-color : #FFFFFF;
	   scrollbar-shadow-color : #050363;
	   background : #C6BA9C;
	 }
	 A {
   	 font:.8em Verdana, Arial, Helvetica, sans-serif;
  	 text-decoration: none;
	 }
	 A:LINK {
   	 color : #000000;
	 }
	 A:VISITED {
	   color : #000000;
	 }
	 A:ACTIVE {
     color : #000000;
	 }
	 A:HOVER {
     color : #FFF78C;
	 }
	 A:FOCUS {
     color : #000000;
	 }
	 h1 {
   		font:1.8em Verdana, Arial, Helvetica, sans-serif;
	 }
	 h2 {
  	 font:1.7em Verdana, Arial, Helvetica, sans-serif;
	 }
	 h3 {
  	 font:1.6em Verdana, Arial, Helvetica, sans-serif;
	 }
	 h4 {
   	 font:1.5em Verdana, Arial, Helvetica, sans-serif;
	 }
   h5 {
     font:1.4em Verdana, Arial, Helvetica, sans-serif;
   }
   h6 {
     font:1.3em Verdana, Arial, Helvetica, sans-serif;
   }
   h7 {
     font:1.2em Verdana, Arial, Helvetica, sans-serif;
	 }
	 #desc {
	 	padding: 0px 0px 10px 0px;
	  font-family : Arial, Helvetica, sans-serif;
	 }
	 #cont0 {
	 }
	 #cont1 {
	 }
	 #cont2 {
	 }
	 #cont3 {
	 }
	 #cont4 {
	 }
	 #cont5 {
	 }
	 #cont6 {
	 }
	 #cont7 {
	 }
	 #0 {
     background-color : #B5B6B5;
	 }
	 #1 {
     background-color : #C6BA9C;
	 }
	 #2 {
     background-color : #B5B6B5;
	 }
	 #3 {
     background-color : #C6BA9C;
	 }
	 #4 {
     background-color : #B5B6B5;
	 }
	 #5 {
     background-color : #B5B6B5;
	 }
	 #6 {
     background-color : #B5B6B5;
	 }
	 #7 {
     background-color : #B5B6B5;
	 }
	 </style>
	 </head>
";

echo "
	 <body>
";

// minimal error reporting from expat.
if(!$xbel->Error) {			 
	 // top anchor holder, you can place this also at
	 // bottom when the content is placed under the list
  echo "
	 $xbel->Top
	 
	 <table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" width=\"800\">
	 <tr>
	 	 <td align=\"center\">
		 <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
			<tr>
  ";



	// "$xbel->Content" is your content list
	// it is a single string with | concatenated
	// you can place it either above or under your
	// content list
	$acounter = 1;
	
	$tok = strtok($xbel->Content,"|");
	while ($tok) {
    if (preg_match ("/\bcont2\b/i", $tok)) {
		  echo '<td width=\"33%\">' . $tok . '</td>';
		  if ($acounter == 3) {
			  echo '</tr><tr>';
			  $acounter = 1;
			}
			else {
			  $acounter++;
			}
		}
    $tok = strtok("|");
  }

	// $xbel->Output is the main xbel list
	// just echo it to the stdout.
  echo "
			</tr>
		  </table>
		 </td>
	 </tr>
	 <tr>
		  <td align=\"center\">
			  $xbel->Output
			</td>
	 </tr>
	 </table>
  ";
}
else {
	die('Error in instantiating expatXBEL class: ' . $xbel->Error);
}

echo "	 
	 </body>
	 </html>
";
	 
?>