PHP Classes

File: docs.php

Recommend this page to a friend!
  Classes of khalid al-kary   Kxparse   docs.php   Download  
File: docs.php
Role: Documentation
Content type: text/plain
Description: the file that manipulates the Docs XML file
Class: Kxparse
A very light XML parser!
Author: By
Last change: Changes of the documentation script to be compaitable with the new API
Date: 21 years ago
Size: 5,008 bytes
 

Contents

Class file image Download
<?php //including khalid XML parser include_once "kxparse.php"; //create the object $xmldocs=new kxparse(getcwd()."/documentation.xml"); //disable namespaces support $xmldocs->set_ns(false); $xmldocs->set_CD(false); //get the place in the XML file $place=@$_REQUEST['place'] or $place=null; $num=@$_REQUEST['num'] or $num=null; if ($place!="base" && $place!="api") { $place=null; } if ($place!=null) { settype($num,"integer"); $num=floor($num); $co=$xmldocs->count_tag("documentation:api:function","1:1:?"); if ($num>$co) { $num=$co; } if ($num<1) { $num=1; } } //convert it to a reaadable text from the XML file function convert_to_name($str,$obj) { if ($str=="base") { return $obj->get_attribute("documentation:basic","1:1","title"); } else if ($str=="api") { return $obj->get_attribute("documentation:api","1:1","title"); } else { return "Documentation"; } } ?> <html> <head> <title>Kxparse | A very light XML parser!</title> <link rel="stylesheet" type="text/css" href="kxparse.css"> </head> <body valign="top" style="margin:0px;"> <table cellpadding="0" cellspacing="0" border="0" style="width:750px;height:100%"> <tr> <td colspan="3" style="background-color:#0184FF;border-right:#000080 1px solid;border-bottom:#000080 1px solid;width:100%;height:117px;"> <a href="index.php"><img src="logo.jpg" style="height:117px;width:371px;border:black 0px solid;"></a> </td> </tr> <tr> <td colspan="3" style="height:5px;"></td> </tr> <tr> <td style="width:125px;border-top:#000080 1px solid;border-bottom:#000080 1px solid;border-right:#000080 1px solid;background-color:#0184FF;" valign="top"> <div style="width:125px;" valign="top"> <?php include_once "nav.php"; ?> </div> </td> <td style="width:5px;"></td> <td style="width:600px;" valign="top"> <div class="bar">:: <?php echo ($place==null) ? ("Documentation") : (convert_to_name($place,$xmldocs))?> ::</div> <div style="height:7px;"><img src="pixel.gif" height="1" width="1"></div> <div class="text"> <center style="color:red"><?php echo $xmldocs->get_attribute("documentation","1","status") ?></center> <?php if ($place==null) {?> <ul> <li><a href="docs.php?place=base">Basics</a></li> <li>API Documentation <ul> <?php $arr=array(); $num=$xmldocs->count_tag("documentation:api:function","1:1:?"); for ($i=1;$i<=$num;$i++) { $arr[$i-1]=array(); $arr[$i-1][0]=$xmldocs->get_attribute("documentation:api:function","1:1:".$i,"name"); $arr[$i-1][1]=$xmldocs->get_attribute("documentation:api:function","1:1:".$i,"text"); $arr[$i-1][2]=$i; } sort($arr); for ($i=0;$i<count($arr);$i++) { ?> <li><a href="docs.php?place=api&num=<?php echo $arr[$i][2] ?>"><?php echo $arr[$i][0] ?></a> -- <?php echo $arr[$i][1] ?></li> <?} ?> </ul> </li> </ul> </div> <?}?> <?php if ($place=="base") {?><br><? for ($i=1;$i<=$xmldocs->count_tag("documentation:basic:base","1:1:?");$i++) {?> <div class="title"><?php echo $xmldocs->get_attribute("documentation:basic:base","1:1:".$i,"title") ?></div> <div class="text" style="font-size:15px;"><?php echo str_replace("\n","<br>",str_replace("\t","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",$xmldocs->get_tag_text("documentation:basic:base","1:1:".$i))) ?></div> <div style="height:7px;"><img src="pixel.gif" height="1" width="1"></div> <?}?><br> <div class="bar" style="width:100%;"><a href="docs.php">Documentation home</a></div><?} ?> <?php if ($place=="api") {?> <div style="height:10px;"><img src="pixel.gif" height="1" width="1"></div> <div class="bar"><?php echo $xmldocs->get_attribute("documentation:api:function","1:1:".$num,"name") ?></div> <div style="height:7px;"><img src="pixel.gif" height="1" width="1"></div> <div class="text" style="color:green"><?php echo $xmldocs->get_attribute("documentation:api:function","1:1:".$num,"text") ?></div><br> <div class="text"><?php echo str_replace("\n","<br>",str_replace("\t","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",$xmldocs->get_tag_text("documentation:api:function","1:1:".$num))) ?> <br><br> <?php $farr=array(); for ($i=1;$i<=$xmldocs->count_tag("documentation:api:function","1:1:?");$i++) { $farr[$i-1]=array(); $farr[$i-1][0]=$xmldocs->get_attribute("documentation:api:function","1:1:".$i,"name"); $farr[$i-1][1]=$i; } sort($farr); for ($b=0;$b<count($farr);$b++) { if ($farr[$b][1]==$num) { $num=$b; break; } } ?> <div class="bar" style="width:100%;text-align:center;"> <?php if ($num!=0) {?> <a href="docs.php?place=api&num=<?php echo $farr[$num-1][1] ?>"><< <?php echo $farr[$num-1][0] ?></a> - <? } ?> <a href="docs.php">Documentation home</a> <?php if ($num<count($farr)-1) {?> - <a href="docs.php?place=api&num=<?php echo $farr[$num+1][1] ?>"><?php echo $farr[$num+1][0] ?> >></a><? } ?> </div> <?} ?> <br><br> </td> </tr> </table> </body> </html>