本文整理匯總了PHP中post::create_post方法的典型用法代碼示例。如果您正苦於以下問題:PHP post::create_post方法的具體用法?PHP post::create_post怎麽用?PHP post::create_post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類post
的用法示例。
在下文中一共展示了post::create_post方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validate_post_form
public static function validate_post_form($post_id, $post_title, $post_title, $post_content, $post_image, $post_date, $post_cat_id, $post_user_id, $post_venue, $post_time_stamp, $post_address_1, $post_address_2, $post_state, $post_city, $post_zip)
{
$create_post_ok = 'N';
if (isset($_POST['submit'])) {
if (empty($post_title)) {
echo 'post Name field must not be empty, please enter a name for your post';
} else {
$create_post_ok = 'Y';
}
if (empty($post_date)) {
echo 'Please set a date for your post';
} else {
$create_post_ok = 'Y';
}
if (empty($post_venue)) {
echo 'Please enter a venue for your post';
} else {
$create_post_ok = 'Y';
}
if ($create_post_ok == 'Y') {
$post = new post();
$post->create_post($post_id, $post_title, $post_title, $post_content, $post_image, $post_date, $post_cat_id, $post_user_id, $post_venue, $post_time_stamp, $post_address_1, $post_address_2, $post_state, $post_city, $post_zip);
}
} else {
echo 'Enter post info';
}
}
示例2: catch
} catch (Exception $e) {
//put error message to the client
}
break;
case 'registration':
try {
$register = new registration($_POST['name'], $_POST['email'], $_POST['last_name'], $_POST['first_name'], $_POST['password']);
header("Location: index.php?p=login");
} catch (Exception $e) {
//put error message to the client
}
break;
case 'post':
if (!$_POST["post_id"]) {
$post = new post();
$post_id = $post->create_post($_POST["title"], $_POST["date"], htmlentities($_POST["content_code"]), $_POST["category"], $_POST["status"], $_POST["tag_list"], $_COOKIE['ea_user']);
header('Location: index.php?p=edit_post&id=' . $post_id);
} else {
$post = new post();
post::update_post($_POST["title"], $_POST["date"], htmlentities($_POST["content_code"]), $_POST["category"], $_POST["status"], $_POST["tag_list"], $_POST["post_id"]);
//itt lehet majd bővíteni, kész a többi opció
header('Location: index.php?p=edit_post&id=' . $_POST["post_id"]);
}
break;
case 'category':
if (!isset($_POST['cat_name'])) {
category::update_category_list($_POST);
header('Location: index.php?p=category');
} else {
$category = new category();
$category->create_category($_POST['cat_name']);