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