本文整理汇总了PHP中Wiki::getDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP Wiki::getDocument方法的具体用法?PHP Wiki::getDocument怎么用?PHP Wiki::getDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wiki
的用法示例。
在下文中一共展示了Wiki::getDocument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addField
<?php
require_once 'includes/class_Wiki.inc.php';
try {
//Used for editing, we already have an id
$wikiDocument = Wiki::getDocument($_GET['page']);
} catch (Exception $e) {
//Used for processing
$wikiDocument = new WikiDocument($_POST['title']);
}
if (isset($_POST['process'])) {
if (is_array($_POST['fieldTitle']) && is_array($_POST['fieldBody'])) {
for ($i = 0; $i < sizeOf($_POST['fieldTitle']); $i++) {
$body = trim($_POST['fieldBody'][$i]);
$field = trim($_POST['fieldTitle'][$i]);
if (strlen($body) > 0 && strlen($field) > 0 && $body != "Field Title" && $field != "Field Body") {
$wikiDocument->addField($_POST['fieldTitle'][$i], $_POST['fieldBody'][$i]);
}
}
$wikiDocument->addField(WikiDocument::FIELD_DATETIME, time());
Wiki::addDocument($wikiDocument);
header("Location: viewPage.php?page=" . $wikiDocument->getId());
exit;
}
}
require_once "header.php";
?>
<script type="text/javascript">
function addField() {
var tmpNode = document.createElement("div");
tmpNode.innerHTML = '<div class="formTitle"><input type="text" name="fieldTitle[]" onclick="if(this.value==\'Field Title\') this.value=\'\';" value="Field Title">:</div><textarea name="fieldBody[]" onclick="if(this.value==\'Field Body\') this.value=\'\';">Field Body</textarea>';
示例2: catch
<?php
require_once 'includes/class_Wiki.inc.php';
//$_GET['page'] = utf8_encode($_GET['page']);
try {
$wikiDocument = Wiki::getDocument($_GET['page'], $_GET['revision']);
} catch (Exception $e) {
//Page Not Found
header("Location: index.php");
exit;
}
require_once "header.php";
?>
<div>
<?php
foreach ($wikiDocument->getField(WikiDocument::ALL_SHOWN_FIELDS) as $key => $field) {
if (strlen(trim($field)) == 0) {
continue;
}
?>
<h2><?php
echo $key;
?>
</h2>
<p><?php
echo str_replace("\n", "</p><p>", $field);
?>
</p>
<?php
}
?>