2012-04-12 69 views
0

我想在我的PHP腳本在後臺運行時顯示某些內容並鎖定屏幕。在PHP腳本上設置jQuery BlockUI

腳本可能需要很長的時間來運行,因爲它是在元數據爲拉動的URL列表,所以這取決於多少網址輸入到它可能需要長達5分鐘的文本區域。

我想使用BlockUI jQuery代碼,但不知道如何設置它在我的PHP腳本任何人都可以幫助我嗎?

這裏是我的代碼:

<form method="get" action=<?php echo "'".$_SERVER['PHP_SELF']."'";?> > 
<p>URL of Competitor:</p> 
<textarea name="siteurl" rows="10" cols="50"> 
<?php //Check if the form has already been submitted and if this is the case, display  the submitted content. If not, display 'http://'. 
echo (isset($_GET['siteurl']))?htmlspecialchars($_GET['siteurl']):"http://";?> 
</textarea><br> 
<input type="submit" value="Submit"> 
</form> 
<div id="nofloat"></div> 
<table class="metadata" id="metatable_1"> 
<?php 
ini_set("display_errors", 0); 
function parseUrl($url){ 
    //Trim whitespace of the url to ensure proper checking. 
    $url = trim($url); 
    //Check if a protocol is specified at the beginning of the url. If it's not,  prepend 'http://'. 
    if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { 
      $url = "http://" . $url; 
    } 
    //Check if '/' is present at the end of the url. If not, append '/'. 
    if (substr($url, -1)!=="/"){ 
      $url .= "/"; 
    } 
    //Return the processed url. 
    return $url; 
} 
//If the form was submitted 
if(isset($_GET['siteurl'])){ 
    //Put every new line as a new entry in the array 
    $urls = explode("\n",trim($_GET["siteurl"])); 
    //Iterate through urls 
    foreach ($urls as $url) { 
      //Parse the url to add 'http://' at the beginning or '/' at the end if not already there, to avoid errors with the get_meta_tags function 
      $url = parseUrl($url); 
      //Get the meta data for each url 
      $tags = get_meta_tags($url); 
      //Check to see if the description tag was present and adjust output accordingly 
      echo (isset($tags['description']))?"<tr><td>Description($url)</td> <td>".$tags['description']:"<tr><td>Description($url)</td><td>No Meta Description</td> </tr>."; 
    } 
} 
?> 
</table> 
<script type="text/javascript"> 
     var exportTable1=new ExportHTMLTable('metatable_1'); 
    </script> 
<div> 
     <input type="button" onclick="exportTable1.exportToCSV()" value="Export to CSV"/> 
     <input type="button" onclick="exportTable1.exportToXML()"  value="Export to XML"/> 
    </div> 

這裏是鏈接到了jQuery UI座:http://jquery.malsup.com/block/#demos

也將我需要包括的文件?

這將是巨大的,如果有人可以點我在正確的方向:)

非常感謝!

瑞奇

回答

0

把PHP在一個單獨的文件,然後使用AJAX調用腳本並返回結果頁面檢索一次?

+0

對不起,我是新手,我不明白 – RuFFCuT 2012-04-12 10:00:21