本文整理匯總了PHP中WCF::calculatePostPage方法的典型用法代碼示例。如果您正苦於以下問題:PHP WCF::calculatePostPage方法的具體用法?PHP WCF::calculatePostPage怎麽用?PHP WCF::calculatePostPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WCF
的用法示例。
在下文中一共展示了WCF::calculatePostPage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
$insert2->bindParam(':time', $time, PDO::PARAM_STR);
$insert2->bindParam(':author', $CURUSER->get('id'), PDO::PARAM_INT);
$insert2->bindParam(':flags', $postFlags, PDO::PARAM_INT);
$insert2->execute();
if ($insert2->rowCount() > 0) {
$postId = $DB->lastInsertId();
//Update the topic with the post id
$update = $DB->prepare("UPDATE `wcf_topics` SET `posts` = `posts` + 1, `lastpost_id` = :post, `lastpost_time` = :time WHERE `id` = :topic LIMIT 1;");
$update->bindParam(':topic', $topicId, PDO::PARAM_INT);
$update->bindParam(':post', $postId, PDO::PARAM_INT);
$update->bindParam(':time', $time, PDO::PARAM_STR);
$update->execute();
//Update the forum
$update = $DB->prepare("UPDATE `wcf_forums` SET `posts` = `posts` + 1 WHERE `id` = :forum LIMIT 1;");
$update->bindParam(':forum', $forumId, PDO::PARAM_INT);
$update->execute();
######################################
########## Redirect ##################
$PostPage = WCF::calculatePostPage($postId);
//bind the onsuccess message
$ERRORS->onSuccess('Success.', '/forums.php?page=topic&id=' . $topicId . '&p=' . $PostPage . '#post-' . $postId);
//Trigger it
$ERRORS->triggerSuccess();
} else {
$ERRORS->Add('The topic you are replying on might have been removed. Cannot continue.');
}
} else {
$ERRORS->Add('The website failed to insert your post. Please contact the administration.');
}
$ERRORS->Check('/forums.php?page=post_reply');
exit;