2011-03-20 72 views
-5

嗯,我發現這個流腳本,但保存數據的區域的實際設計是在CSS中。但我不知道css,所以我想知道你是否可以告訴我如何將它改爲HTML。我不是說在HTML中再次編寫代碼..我的意思是告訴我在哪裏可以輸入我的HTML。所有腳本here如何將此腳本更改爲

腳本與CSS:

/* grab stuff */ 
    function get_posts($start = 0, $number_of_posts = 5) { 
     /* connect to the db */ 
     $connection = mysql_connect('localhost','root',''); 
     mysql_select_db('draft2',$connection); 
     $posts = array(); 
     /* get the posts */ 
     $query = "SELECT item_id, username, item_content ID FROM wp_posts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT $start,$number_of_posts"; 
     $result = mysql_query($query); 
     while($row = mysql_fetch_assoc($result)) { 
      preg_match("/<p>(.*)<\/p>/",$row['post_content'],$matches); 
      $row['post_content'] = strip_tags($matches[1]); 
      $posts[] = $row; 
     } 
     /* return the posts in the JSON format */ 
     return json_encode($posts); 
    } 

?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> 
<head> 
    <title>Create a Twitter-Like "Load More" Widget Using CSS, HTML, JSON, and jQuery or MooTools Javascript</title> 
    <style type="text/css"> 
     #posts-container   { width:400px; border:1px solid #ccc; -webkit-border-radius:10px; -moz-border-radius:10px; } 
     .post      { padding:5px 10px 5px 100px; min-height:65px; border-bottom:1px solid #ccc; background:url(dwloadmore.png) 5px 5px no-repeat; cursor:pointer; } 
     .post:hover     { background-color:lightblue; } 
     a.post-title    { font-weight:bold; font-size:12px; text-decoration:none; } 
     a.post-title:hover   { text-decoration:underline; color:#900; } 
     a.post-more     { color:#900; } 
     p.post-content    { font-size:10px; line-height:17px; padding-bottom:0; } 
     #load-more     { background-color:#eee; color:#999; font-weight:bold; text-align:center; padding:10px 0; cursor:pointer; } 
     #load-more:hover   { color:#666; } 
     .activate     { background:url(loadmorespinner.gif) 140px 9px no-repeat #eee; } 
    </style> 

如果你知道如何做到這一點,你能不能告訴我:d

+11

SO不是你的猴子編碼員。 – 2011-03-20 22:36:09

+3

學習必要的CSS比直接設計HTML更好,因此咬住子彈並花費必要的時間可能是個好主意。 – 2011-03-20 22:40:25

+0

我在問你爲我指點什麼..我問我在哪裏寫HTML在這個腳本。你甚至不必寫任何東西! – user663049 2011-03-20 23:15:36

回答

1

CSS僅僅是應用樣式到HTML,如果你想HTML添加到窗體你應該但它在身體標記。 (順便說一句,你的代碼鏈接不工作)