本文整理匯總了PHP中Content::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Content::getId方法的具體用法?PHP Content::getId怎麽用?PHP Content::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Content
的用法示例。
在下文中一共展示了Content::getId方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: content
public function content()
{
load('extend');
$id = $_GET['detail'];
//獲取完整導航數據
$menu = new Menu();
$nav = $menu->getMenu();
$this->assign('menu', $nav);
$navInfo = $menu->getNavInfo($id);
//獲取熱門文章與最新文章
$nhArticle = new Article();
$hotArticle = $nhArticle->getHotArticle();
$newlyArticle = $nhArticle->getNewlyArticle();
$dailyData = $nhArticle->getDailyArticle();
//獲取當前一級列表數據
$name = $menu->getLoneMenuName($id);
$this->assign('Lone', $name);
//獲取二級列表數據
$list = $menu->getList($id);
$this->assign('subList', $list);
//獲取內容
$content = new Content($id);
$tid = $content->getId();
$this->assign('currentId', $tid);
//獲取點擊導航後的路徑數組
$navarr = $content->getNavPath();
$this->assign('navarr', $navarr);
//dump($navarr);
$tpl = $content->getTpl();
$cont = $content->getDeContent();
if ($tpl == 'Content:index') {
$this->assign('list', $cont['list']);
$this->assign('hot', $hotArticle);
//全局熱點資訊
$this->assign('page', $cont['pager']);
//翻頁
$this->assign('week', $cont['weeklyHot']);
//本類別下一周熱點
$this->assign('newly', $newlyArticle);
//全局最新資訊
$this->assign('count', $cont['count']);
//當前分類下資訊總數
$this->assign('weekCount', $cont['weekNewCount']);
//當前分類下周新增資訊總數
$this->assign('navInfo', $navInfo);
//當前分類詳細信息
$this->assign('dailyCount', $dailyData['count']);
$this->assign('dailyArticle', $dailyData['data']);
//dump($cont['hot']);
//dump($cont['count']);
//exit;
} else {
$this->assign('content', $cont['artdetail']);
//dump($cont['artdetail']);
//exit;
$this->assign('hot', $cont['hot']);
}
$this->display($tpl);
}
示例2: delete
public function delete(Content $image)
{
$filename = self::PHOTOS_DIRECTORY . $image->getFilename();
if (file_exists($filename)) {
unlink($filename);
//delete the file
}
$query = "DELETE FROM images WHERE id={$image->getId()} LIMIT 1";
self::$mysqli->query($query);
}
示例3: getClickThroughLink
/** Get the clickthrough-logged equivalent of a sincle URL (http, https or ftp) */
private static function getClickThroughLink($hyperlink, Content &$content, $node, $user)
{
$node ? $node_id = urlencode($node->getId()) : ($node_id = null);
$user ? $user_id = urlencode($user->getId()) : ($user_id = null);
return htmlspecialchars(BASE_URL_PATH . "clickthrough.php?destination_url=" . urlencode($hyperlink) . "&content_id=" . urlencode($content->getId()) . "&node_id={$node_id}&user_id={$user_id}");
}
示例4: findPreviousInDateOrder
/**
* Returns the previous published content in order if sorted by publication date.
* Only returns contents that are published and whose publication date does not lie in the future.
* The order used is the same as in findPublished().
*
* @param Content $currentContent The current content
* @param \DateTime $currentDate The date used to determine if a publication date lies in the future. If null or omitted, today is used.
* @return null|Content The previous content before $currentContent, or null if $currentContent is the first one.
*/
public function findPreviousInDateOrder(Content $currentContent, \DateTime $currentDate = null)
{
if (null === $currentDate) {
$currentDate = new \DateTime();
}
// Find contents with same date
$query = $this->createQueryBuilder('n');
$query->andWhere('n.public = true');
$query->andWhere('n.publicationDate <= :currentDate');
$query->andWhere('n.publicationDate = :contentDate');
$query->andWhere('n.publishedUntil >= :currentDate');
$query->orWhere('n.publishedUntil IS NULL');
$query->setParameter('currentDate', $currentDate);
$query->setParameter('contentDate', $currentContent->getPublicationDate());
$contentsSameDate = $query->getQuery()->getResult();
if (!empty($contentsSameDate) && !($contentsSameDate[count($contentsSameDate) - 1]->getId() == $currentContent->getId())) {
// Return next in list
for ($i = 0; $i < count($contentsSameDate); $i++) {
if ($contentsSameDate[$i]->getId() == $currentContent->getId()) {
return $contentsSameDate[$i + 1];
}
}
}
// No next one at current date, search for newer ones
$query = $this->createQueryBuilder('n');
$query->andWhere('n.public = true');
$query->andWhere('n.publicationDate <= :currentDate');
$query->andWhere('n.publicationDate < :contentDate');
$query->andWhere('n.publishedUntil >= :currentDate');
$query->orWhere('n.publishedUntil IS NULL');
$query->setParameter('currentDate', $currentDate);
$query->setParameter('contentDate', $currentContent->getPublicationDate());
$query->addOrderBy('n.publicationDate', 'desc');
$query->addOrderBy('n.id', 'asc');
$query->setMaxResults(1);
$nextContent = $query->getQuery()->getResult();
if (empty($nextContent)) {
// No older contents
return null;
} else {
return $nextContent[0];
}
}
示例5: removeContent
/** Remove content from this node */
public function removeContent(Content $content)
{
$db = AbstractDb::getObject();
$content_id = $db->escapeString($content->getId());
$sql = "DELETE FROM user_has_content WHERE user_id='{$this->id}' AND content_id='{$content_id}'";
$db->execSqlUpdate($sql, false);
return true;
}
示例6: delete
public function delete(Content $content)
{
$query = "DELETE FROM albums WHERE id={$content->getId()} LIMIT 1";
self::$mysqli->query($query);
}
示例7: content
public function content()
{
load('extend');
//$id=$_GET['detail'];
$id = 1;
//獲取完整導航數據
$menu = new Menu();
$nav = $menu->getMenu();
$this->assign('menu', $nav);
//獲取當前一級列表數據
$name = $menu->getLoneMenuName($id);
$this->assign('Lone', $name);
//獲取二級列表數據
$list = $menu->getList($id);
$this->assign('subList', $list);
//獲取內容
$content = new Content($id);
$tid = $content->getId();
$this->assign('currentId', $tid);
//獲取點擊導航後的路徑數組
$navarr = $content->getNavPath();
$this->assign('navarr', $navarr);
$tpl = $content->getTpl();
$cont = $content->getDeContent();
if ($tpl == 'Content:index') {
$this->assign('list', $cont['list']);
$this->assign('hotNews', $cont['hot']);
$this->assign('page', $cont['pager']);
} else {
$this->assign('content', $cont['artdetail']);
$this->assign('hot', $cont['hot']);
}
dump($tpl);
//exit;
$this->display($tpl);
}
示例8: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Content $value A Content object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Content $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例9: setContent
/**
* Declares an association between this object and a Content object.
*
* @param Content $v
* @return Cmspage The current object (for fluent API support)
* @throws PropelException
*/
public function setContent(Content $v = null)
{
if ($v === null) {
$this->setContentId(NULL);
} else {
$this->setContentId($v->getId());
}
$this->aContent = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Content object, it will not be re-added.
if ($v !== null) {
$v->addCmspage($this);
}
return $this;
}
示例10: delete
public function delete(Content $object)
{
$query = "DELETE FROM newsevents WHERE id={$object->getId()} LIMIT 1";
self::$mysqli->query($query);
}