【问题标题】:How to change this script into如何将此脚本更改为
【发布时间】:2011-03-20 22:31:22
【问题描述】:

我找到了这个流脚本,但保存数据的区域的实际设计是在 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

【问题讨论】:

  • SO 不是你的猴子编码员。
  • 学习必要的 CSS 比直接设置 HTML 样式要好,所以咬紧牙关花必要的时间可能是个好主意。
  • 我要求你为我指出一些事情。我问我在这个脚本中在哪里写 html。你甚至不必写任何东西!

标签: php html css


【解决方案1】:

CSS 只是将样式应用于 html,如果你想将 html 添加到你应该的表单中,但它是在 body 标记中。 (顺便说一句,您的代码链接不起作用)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-17
    • 1970-01-01
    • 2020-06-30
    • 1970-01-01
    • 1970-01-01
    • 2013-07-07
    • 1970-01-01
    相关资源
    最近更新 更多