当前位置: 首页>>代码示例>>PHP>>正文


PHP Blog::get_sub方法代码示例

本文整理汇总了PHP中Blog::get_sub方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::get_sub方法的具体用法?PHP Blog::get_sub怎么用?PHP Blog::get_sub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Blog的用法示例。


在下文中一共展示了Blog::get_sub方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: strtolower

if (isset($_GET["type"]) && isset($_GET["query"])) {
    $type = $_GET["type"];
    $query = strtolower($_GET["query"]);
    $search = new Search();
    switch ($type) {
        case "blog":
            $blog = new Blog();
            $results = $search->find_articles($query);
            if ($search->num_results() > 0) {
                ?>
<p>Order By: <a href="#" id="order_relevance">Relevance</a> | <a href="#" id="order_name">Name</a></p><?php 
                $sum = array_sum($results);
                $q = explode(" ", $query);
                foreach ($results as $key => $value) {
                    $current = $blog->get($key);
                    $current_meta = $blog->get_sub("meta", $key, array("tags", "author"));
                    echo "<div class=\"search_result\"><h2><a href=\"blog.php?p=read&amp;id={$key}\" rel=\"{$value}\" id=\"r{$key}\">", $current["head"], "</a></h2><h3>", $current["subh"], "</h3><span>Relevance: <strong>", substr($value / $sum * 100, 0, 5), "%</strong> ({$value} pts)</span><div class=\"article_body\" style=\"display: none; margin: 10px;\">";
                    echo "<p>";
                    $special_chars = array(".", ",", "-", "[", "]", "\\", "/", "|", "(", ")", "!", "@", "#", "\$", "%", "&", "*", "_", "?");
                    $body = str_replace(array("\n\n", "\n"), array("</p><p>", " <br /> "), $current["body"]);
                    $body = str_replace($special_chars, "", $body);
                    $body = explode(" ", $body);
                    foreach ($q as $qk => $qv) {
                        $color = "ff" . dechex($qk . "20") . "0f";
                        foreach ($body as $bk => $bv) {
                            if (ereg($qv, $bv)) {
                                $body[$bk] = str_replace($bv, "<span style=\"color: #{$color}; font-size: 18px; font-family: Tahoma\">" . $bv . "</span>", $body[$bk]);
                            }
                        }
                    }
                    echo implode(" ", $body), "</p><p>Tags: ", $current_meta["tags"], ", Written By: ", $current_meta["author"], "</p></div></div>";
开发者ID:BGCX261,项目名称:zombiecms-svn-to-git,代码行数:31,代码来源:search.php

示例2: isset

}
?>
			<?php 
$p = isset($_GET["p"]) ? $_GET["p"] : "add";
switch ($p) {
    case "mod":
    case "add":
        $blog = new Blog();
        $data = array("head" => "", "subh" => "", "body" => "");
        $meta = array("allow_comments" => 1, "tags" => "", "published" => 1, "author" => $_SESSION["admin_user"]);
        $root = get_entities("zombie_roots", $_SESSION["id"], array("groups"));
        $root = explode(", ", $root["groups"]);
        $meta["groups"] = array("all");
        if (isset($_GET["id"]) && isset($_GET["p"]) && $_GET["p"] == "mod") {
            $data = $blog->get($_GET["id"], array("head", "subh", "body"));
            $meta = $blog->get_sub("meta", $_GET["id"], array("allow_comments", "tags", "author", "groups", "published"));
            $groups = explode(", ", $meta["groups"]);
        }
        ?>
			<form method="post" id="article_form" action="engine.php?action=<?php 
        echo $p == "add" ? "add_article" : "mod_article";
        if (isset($_GET["id"])) {
            echo "&amp;id=" . $_GET["id"];
        }
        ?>
" enctype="plain/text">
				<p>
				<label for="head">Header</label> <input type="text" name="head" id="head" value="<?php 
        echo $data["head"];
        ?>
"/>
开发者ID:BGCX261,项目名称:zombiecms-svn-to-git,代码行数:31,代码来源:blog.php

示例3: Blog

        ?>
/>
				<input type="submit" class="btn" <?php 
        echo $p == "add" ? "value=\"Create a bloody masterpiece\" id=\"add_article\"" : "value=\"Re-animate\" id=\"mod_article\"";
        ?>
 /><img src="images/btn_right.png" alt="btn_right" class="btn_right" />
				</p>
			</form>
			<?php 
        break;
    case "read":
        if (isset($_GET['id'])) {
            $id = $_GET["id"];
            $blog = new Blog();
            $article = $blog->get($id);
            $meta = $blog->get_sub("meta", $id, array("author"));
            echo "<a href=\"blog.php?p=mod&amp;id=", $id, "\">Modify this Article</a> or <a href=\"blog.php?p=del&amp;id=", $id, "\">delete it</a>";
            echo "<h2>", $article["head"], "</h2>";
            if ($article["subh"] != null) {
                echo "<h3>", $article["subh"], " - By: ", $meta["author"], "</h3>";
            }
            $body = str_replace(array("\n\n", "\n"), array("</p><p>", "<br />"), $article["body"]);
            echo "<p>", $body, "</p>";
            echo "<a href=\"blog.php?p=mod&amp;id=", $id, "\">Modify this Article</a> or <a href=\"blog.php?p=del&amp;id=", $id, "\">delete it</a>";
        } else {
            echo "No article selected";
        }
        break;
    case "del":
        $id = $_GET["id"];
        if (!isset($_GET["ERROR_CODE"]) || !isset($_GET["SUCCESS_CODE"])) {
开发者ID:BGCX261,项目名称:zombiecms-svn-to-git,代码行数:31,代码来源:blog.php


注:本文中的Blog::get_sub方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。