本文整理汇总了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;