本文整理匯總了PHP中News::setContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP News::setContent方法的具體用法?PHP News::setContent怎麽用?PHP News::setContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類News
的用法示例。
在下文中一共展示了News::setContent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getLatestMarshalingEvent
/**
* Get the latest news for the specified news category beetween the specified dates.
*
* @param int $category Category.
*
* @return News[] Returns a news array.
*/
function getLatestMarshalingEvent($category)
{
$sql = "SELECT publish_date, content, title FROM pa_npro_news\n\t\t\t\tWHERE status ='Published'\n\t\t\t\tAND cat_id = {$category}\n\t\t\t\tORDER BY publish_date DESC\n\t\t\t\tLIMIT 1";
$result = $this->connection->query($sql);
$newsItems = array();
while ($row = mysqli_fetch_array($result)) {
$news = new News();
$news->setPublishDate($row['publish_date']);
$news->setContent($row['content']);
$news->setTitle($row['title']);
array_push($newsItems, $news);
}
return $newsItems;
}
示例2: Message
Message::register(new Message(Message::DANGER, i18n(array("en" => "image is required.", "zh" => "請填寫image"))));
$error_flag = true;
}
// validation for $date
$date = isset($_POST["date"]) ? strip_tags($_POST["date"]) : null;
if (empty($date)) {
Message::register(new Message(Message::DANGER, i18n(array("en" => "date is required.", "zh" => "請填寫date"))));
$error_flag = true;
}
/// proceed submission
// proceed for $title
$object->setTitle($title);
// proceed for $summary
$object->setSummary($summary);
// proceed for $content
$object->setContent($content);
// proceed for $thumbnail
$object->setThumbnail($thumbnail);
// proceed for $image
$object->setImage($image);
// proceed for $date
$object->setDate($date / 1000);
if ($error_flag == false) {
if ($object->save()) {
Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "記錄保存成功"))));
HTML::forwardBackToReferer();
} else {
Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "記錄保存失敗"))));
}
}
}
示例3: News
$news->setSummary('Century 21 Student Service has a free consultation for oversea students');
$news->setContent('<p>Century 21 Student Service has a free consultation for oversea students ...</p>');
$news->setThumbnail('files/fixture/news/thumbnail/consultation-education-flagship_572.jpg');
$news->setImage('files/fixture/news/image/consultation-education-flagship_390.jpg');
$news->setDate(1439215200);
$news->save();
$news = new News();
$news->setTitle('News Year bonus program for $300 dollars');
$news->setSummary('We are giving away $300 dollars free credit for students applying for Australian colleges');
$news->setContent('<p>We are giving away $300 dollars free credit for students applying for Australian colleges...</p>');
$news->setThumbnail('files/fixture/news/thumbnail/bonus_568.jpg');
$news->setImage('files/fixture/news/image/bonus_915.jpg');
$news->setDate(1439733600);
$news->save();
$news = new News();
$news->setTitle('UNSW orientation program is on now!');
$news->setSummary('From 3rd Sept to 5th Sept, Century 21 Student service will hold a special orientation session');
$news->setContent('<p>From 3rd Sept to 5th Sept, Century 21 Student service will hold a special orientation session for future students who are planning to study in UNSW.</p>');
$news->setThumbnail('files/fixture/news/thumbnail/unsw_via_stargate_778.jpg');
$news->setImage('files/fixture/news/image/unsw_via_stargate_722.jpg');
$news->setDate(1440079200);
$news->save();
$news = new News();
$news->setTitle('Introduction to CT21 VIP program');
$news->setSummary('Century 21 Student Service has a new VIP program just announced this Friday.');
$news->setContent('<p>Century 21 Student Service has a new VIP program just announced this Friday.</p>');
$news->setThumbnail('files/fixture/news/thumbnail/maxresdefault_797.jpg');
$news->setImage('files/fixture/news/image/maxresdefault_310.jpg');
$news->setDate(1440079200);
$news->save();
}