Rewrite Php To Js

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > JavaScript

Rewrite Php To Js

takashiro
I move my website from joshost.com to drivehq.com because the death of joshost.com. But drivehq.com does not support PHP script. I want to change this php script into JavaScript. But I failed.
How to write these in js as those in php, array(), $_GET, and foreach()?
CODE
<?php
$id=$_GET['id'];
if ($id==""){
$id=4;
};
$swftitle = array (
    1 => "No Way to Say - 浜崎あゆみ",
    2 => "Blue Bird - 浜崎あゆみ",
    3 => "Your Color - BoA",
    4 => "Everlasting - BoA",
    5 => "スビカ- 坂本真綾"
    );
$swffile = array (
    1 => "http://www.56.com/n_v48_/c20_/3_/2_/syaorantae_/1184307980_518_/282000_/0_/15456902.swf",
    2 => "http://www.56.com/n_v164_/c22_/25_/20_/syaorantae_/1184561707_182_/248000_/0_/15548159.swf",
    3 => "http://www.56.com/n_v163_/c23_/29_/28_/syaorantae_/118690028465_/296000_/0_/16700641.swf",
    4 => "http://www.56.com/n_v164_/c23_/1_/16_/syaorantae_/118723136053_/320000_/0_/16923528.swf",
    5 => "http://www.56.com/n_v138_/c28_/4_/6_/syaorantae_/118787613750_/253000_/0_/17406740.swf"
    );
$cdate = array (
    1 => "2007-07-13 14:26:20",
    2 => "2007-07-16 12:55:07",
    3 => "2007-08-12 14:31:24",
    4 => "2007-08-16 10:29:20",
    5 => "2007-08-23 21:35:37"
    );

echo <<< EOT
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>$swftitle[$id] - 犬夜叉 時代を越える旅 - 原创MV</title>
<link href="../style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="760" border="0" align="center" background="../bg_main.gif">
  <tr>
    <td height="57" colspan="2"><img src="title_character.gif" width="434" height="57" /></td>
  </tr>
  <tr>
    <td class="pageName">$swftitle[$id]</td>
    <td class="bodyText">发布时间:$cdate[$id]</td>
  </tr>
  </table>
<table width="760" border="0" align="center" background="../bg_main.gif">
  <tr>
    <td align="center">
    &lt;script language=javascript>
    var url="$swffile[$id]";
    url=url.replace("http://www.56.com/n_","");
    url=url.replace(".swf","");
    url2=url.split('_/');
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="540" height="450">');
    document.write('<param name="allowScriptAccess" value="always" />');
    document.write('<param name="movie" value="http://www.56.com/flashApp/v_player_site.swf">');
    document.write('<param name="FlashVars" value="&img_host='+url2[0]+'.56.com&host='+url2[1]+'.56.com&pURL='+url2[2]+'&sURL='+url2[3]+'&user='+url2[4]+'&user_id='+url2[4]+'&URLid='+url2[5]+'&tag=&Subject=&totaltimes='+url2[6]+'&effectID='+url2[7]+'&flvid='+url2[8]+'&56.swf">');
    document.write('<param name="quality" value="high">');
    document.write('<param name="allowFullScreen" value="true">');
    document.write('<param name="bgcolor" value="#ffffff">');
    document.write('</object>');
    </script/>
    </td>
    <td>
    <table>
    <tr><td class="subtitle">播放列表:</td></tr>
EOT;
foreach ($swftitle as $list => $swftitle){
    echo "<tr><td><a href=./?id=".$list.">".$swftitle."</a></td></tr>";
}
echo <<< EOT
    </table>
    </td>
  </tr>
  </tr>
</table>
<table width="760" border="0" align="center" background="../bg_main.gif">
<tr><td>時代を越える旅 <a href=../>返回主页</a> <a href=../>inuyasha.frih.net</a></td></tr></table>
</body>
</html>
EOT;
?>

 

 

 


Reply

faulty.lee
I don't think there's a direct shortcut to simply convert everything from php to js. They're made for different purpose. Php is server side while js is client side. There're things that you can do in php but can't be done at all in js. Even if you use ajax, you'll need a php side to complete the circle.

Reply

Sten
the real question it, why the hell would you move to a host without php?
theres heaps of free host (almost all of them) that support php.

i suggest astahost but if you just want something quick then http://www.awardspace.com

i used to use it for a while but moved to astahost.



Reply

Habble
Therer probably are functions that do the same thing, but as faulty.lee said, they're used for different purposes. I'd recommend using a php-enabled host.

Reply

takashiro
Thanks. I think that's too hard. Ok, before I get astahost account I'll use several HTML webpage, instead.

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. write php array to js array - 110.05 hr back. (1)
  2. write php in js - 135.75 hr back. (1)
  3. move value from php to js - 149.41 hr back. (1)
  4. www.astahost.com - 466.71 hr back. (1)
Similar Topics

Keywords : rewrite php js


    Looking for rewrite, php, js






*SIMILAR VIDEOS*
Searching Video's for rewrite, php, js
advertisement




Rewrite Php To Js