xml tp html or php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jackrose
    New Member
    • Jun 2008
    • 3

    xml tp html or php

    sir the below script is wap script in xml,if possible to converet html or php plz edit and put here sir
    [HTML]<? //include the space function found on php.net Include ('data/function_dskspa ce.php'); //headers header("Content-type: text/vnd.wap.wml"); echo "<?xml version=\"1.0\" ?>"; echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"http://www.wapforum.or g/DTD/wml_1.1.xml\">" ; //sadhu's genius one line fix $page = $_GET["page"]; //how many files do you want shown on each page? EDIT $conf["items_per_page "] = 7; //if the page number is not set, set it too.. Zero/home if (!isset($page)) {$page = 0;} //open our directory or give error message if(!($dp = opendir("./"))) die ("Cannot open ./"); //array and read directory $file_array = array(); while ($file = readdir ($dp)) { //don't want to show that index really eh if(substr($file ,0,1) != '.' and $file != "index.php" ) { $file_array[] = $file; } } //count files in dir $file_count = count ($file_array); //sort the file order sort ($file_array); //main page ?> <wml> <card id="card1" title="wappyBUD DY"> <p align ="center" mode="nowrap"> <img src="" alt="frendz"/><br/><br/></p><p align ="left" mode="nowrap"> <? //if is no files give error message if ($file_count==" 0"){echo "<small>Sor ry there are $file_count files in this folder!</small>";} //if there is some files if ($file_count > 0) { $first_record = $page * $conf["items_per_page "]; $last_record = $first_record + $conf["items_per_page "]; while (list($fileInde xValue, $file_name) = each ($file_array)) { if (($fileIndexVal ue >= $first_record) AND ($fileIndexValu e < $last_record)) { //icon code so we know the extension of files and can assign the correct gif. I did want to use the mimetype function but found it didn't work on all servers sigh.. $icon = "data/unknown.gif"; $rev = strrev ($file_name); $exp = explode (".", $rev); $true = strrev ($exp[0]); $trueext = strtolower ($true); if ($trueext=="zip " OR $trueext=="rar" OR $trueext=="gz") {$icon = "data/zip.gif";} if ($trueext=="amr "){$icon = "data/amr.gif";} if ($trueext=="mid i"){$icon = "data/midi.gif";} if ($trueext=="mid "){$icon = "data/mid.gif";} if ($trueext=="gif "){$icon = "data/gif.gif";} if ($trueext=="jpe g"){$icon = "data/jpeg.gif";} if ($trueext=="jpg "){$icon = "data/jpg.gif";} if ($trueext=="jad "){$icon = "data/jad.gif";} if ($trueext=="jar "){$icon = "data/jar.gif";} if ($trueext=="sis "){$icon = "data/sis.gif";} if ($trueext=="bmp "){$icon = "data/bmp.gif";} if ($trueext=="wbm p"){$icon = "data/wbmp.gif";} if ($trueext=="txt "){$icon = "data/txt.gif";} if ($trueext=="avi "){$icon = "data/avi.gif";} if ($trueext=="thm "){$icon = "data/thm.gif";} if ($trueext=="nth "){$icon = "data/nth.gif";} if ($trueext=="png "){$icon = "data/png.gif";} if ($trueext=="mmf "){$icon = "data/mp4.gif";} if ($trueext=="wav "){$icon = "data/wav.gif";} //find true path of this site.. Ah don't ya just love php.net $docname = "" . $_SERVER [ 'SERVER_NAME' ] . $_SERVER [ 'PHP_SELF' ]; $path = dirname($docnam e); $path = str_replace ("www.", "", $path); //get rid of ext on files $linkname = str_replace (".$trueext" , "", $file_name); //blah getting bored now.. Time for a joint.. $kb="kb"; $number=($fileI ndexValue+1); //right.. filesize $size = round(filesize( $file_name)/1024,1); //set dir and file values $dirlinks = "<small><im g src=\"data/dir.gif\" alt=\"$number\"/>$file_name [dir]<br/>$number: </small><input type=\"text\" title=\"Directo ry:\" value=\"not allowed [directory]\"/><br/><br/>"; $filelinks = "<small><a href=\"$file_na me\"><img src=\"$icon\" alt=\"$number\"/>$linkname [$size$kb]</a><br/>$number: </small><input type=\"text\" title=\"File URL:\" value=\"http://$path/$file_name\"/><br/><br/>"; //show/determine file an dir if (is_dir($file_n ame)){echo $dirlinks;}else { echo $filelinks;} } } ?> </p><p align ="center" mode="nowrap"> <? //pages set up $mb = "mb"; $pages = (int) ceil($file_coun t / $conf["items_per_page "]); $pages = ($pages -1); if ($pages>0){if ($page=="0"){ec ho "<small>Hom e Page<br/><br/></small>";}else{ echo "<small><br/>Page $page of $pages<br/><br/></small>";}} if (($file_count > 0) AND ($page != 0)) //previous page { $prev_page = $page -1; echo "<small><a href=\"".$_SERV ER["PHP_SELF"]."?page=$prev_p age\">«Prev</a></small>"; } if (($file_count > 0) AND ($last_record < $file_count)) //next page { $next_page = $page + 1; if ($page=="0"){$b reak="";}else{$ break="|";} echo "$break<small>< a href=\"".$_SERV ER["PHP_SELF"]."?page=$next_p age&amp;sid=$si d\">Next»</a></small>"; } //watch for numptys putting non existant pages in jumpbox if ($page>$pages){ echo "<br/><small><br/><br/>This page does not exist!</small>";} //show the jumpbox if($pages>1)ech o "<br/><br/><input emptyok=\"true\ " name=\"jump\" format=\"*N\" size=\"3\" value=\"\" /><small><br/><a href=\"".$_SERV ER["PHP_SELF"]."?page=$(jump) &amp;sid=$sid\" >Jump [1-$pages]</a></small>"; if ($page<$pages){ echo "<br/><small><a href=\"".$_SERV ER["PHP_SELF"]."?page=$pages& amp;sid=$sid\"> Last Page</a></small>";} if ($page=="0" AND $file_count>$co nf["items_per_page "]){echo "<br/>";} if ($page>0){echo "<br/><small><a href=\"".$_SERV ER["PHP_SELF"]."?page=0&amp;s id=$sid\">Home Page</a><br/></small>";} //file count echo "<small><br/>$file_count </small>"; //diskspace $space = dskspace ('./'); $space = round ($space/1024000,1); //show em lol echo "<small>fil es [$space$mb]</small>"; //show the path so ya site url is at bottom echo "<br/><small>$path </small>"; } //close our directory ah.. closedir($dp); //WE REQUEST THAT YOU DO NOT REMOVE THE COPYRIGHT/LINK BELOW. //GIVE CREDIT WHERE CREDIT IS DUE! echo "<small><br/>All Rights Reserved<br/>©2003, 2006 <a href=\"http://hack.s-60.org\">raghu</a><u>&</u><a href=\"http://jonroig.com\">j on</a></small>"; ?> </p> </card> </wml> [/HTML]
    Last edited by Atli; Jun 25 '08, 04:25 AM. Reason: Removed bold text. Please do not post your entire text in bold!
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    First of all... that has to be the worst formated piece of code I've ever seen!
    What happened to all the new-line chars?

    Second. We are not here to create your code for you. Try it yourself and post back if you have any specific problems and we will be happy to do what we can to help you.

    If you are just asking for some tips on how to do this, please specify what it is you are attempting to do. I can't really make out what it is you want from the vague statement you made in your post.

    Lastly, I would ask that you read through the Posting Guidelines before posting again, specifically the part about How to ask a question.

    Thanks.

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      Originally posted by Atli
      First of all... that has to be the worst formated piece of code I've ever seen!
      lol!.. I agree

      Hey Jackrose,
      Its not a regular thing to convert WML to HTML as they have different approach. HTML page is one page, shown at screen at one time. But WML may contain multiple cards (one time screens). So you first need to separate the cards. Then for each card, you would need to convert the markup to HTML.

      I would suggest, if this is the only page you need to convert, do it manually. But if the list is long, you should try to make a markup convector using PHP and RegExp.

      But I see that there's PHP in the code along with WML, so you need to convert the generated markup and then place it back in the PHP.

      Regards

      Comment

      Working...