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