本文整理汇总了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&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>";
示例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 "&id=" . $_GET["id"];
}
?>
" enctype="plain/text">
<p>
<label for="head">Header</label> <input type="text" name="head" id="head" value="<?php
echo $data["head"];
?>
"/>
示例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&id=", $id, "\">Modify this Article</a> or <a href=\"blog.php?p=del&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&id=", $id, "\">Modify this Article</a> or <a href=\"blog.php?p=del&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"])) {