本文整理汇总了PHP中Article::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::get方法的具体用法?PHP Article::get怎么用?PHP Article::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detail
function detail($title_none = NULL)
{
$cat_news_url = $this->uri->segment(1);
$cat_news = new Newscatalogue();
$cat_news->where(array('name_none' => $cat_news_url))->get();
if (!$cat_news->exists()) {
show_404();
}
$dis['cat_news'] = $cat_news;
$cat = $this->uri->segment(2);
$category = new Newscatalogue();
$category->where(array('name_none' => $cat, 'parentcat_id' => $cat_news->id))->get();
if (!$category->exists()) {
show_404();
}
$dis['category'] = $category;
$title_none = geturlfromuri($this->uri->segment(3));
$news = new Article();
$news->where(array('title_none' => $title_none, 'newscatalogue_id' => $category->id));
$news->get();
if (!$news->exists()) {
redirect(base_url() . $this->uri->segment(1, '') . '/' . $this->uri->segment(2, ''));
die;
}
$dis['news'] = $news;
$tag = $news->tag;
$dis['tag'] = explode(',', $tag);
$news->view_count = $news->view_count + 1;
$news->save();
//related news
$related_news = new Article();
$related_news->where('recycle', 0);
$related_news->where('newscatalogue_id', $news->newscatalogue_id);
$related_news->where("id !=", $news->id);
$related_news->order_by('created', 'DESC');
$related_news->get_paged(0, 15, TRUE);
$dis['related_news'] = $related_news;
$arrayCateNewsId = array();
foreach ($this->guideCate as $row) {
$arrayCateNewsId[] = $row->id;
}
$arrayCateNewsId = array();
foreach ($this->guideCate as $row) {
$arrayCateNewsId[] = $row->id;
}
// get news view most
$newViewMost = new Article();
$newViewMost->where('recycle', 0);
$newViewMost->where_in('newscatalogue_id', $arrayCateNewsId);
$newViewMost->order_by('view_count', 'desc');
$newViewMost->get(5);
$dis['newViewMost'] = $newViewMost;
// get news view most
$newView = new Article();
$newView->where('recycle', 0);
$newView->where_in('newscatalogue_id', $arrayCateNewsId);
$newView->order_by('created', 'desc');
$newView->get(5);
$dis['newView'] = $newView;
$this->page_title = $news->{'title_vietnamese'} . ' | SotayNhadat.vn';
$this->page_description = $news->short_vietnamese;
$this->page_keyword = $news->tag;
$this->url = base_url() . substr($this->uri->uri_string, 1, strlen($this->uri->uri_string));
$this->isRobotFollow = 1;
$dis['base_url'] = base_url();
$dis['view'] = 'front/guides/news_de';
$this->viewfront($dis);
}
示例2: loadCustomCssJs
public function loadCustomCssJs()
{
$managerUrl = $this->context->getOption('manager_url', MODX_MANAGER_URL, $this->modx->_userConfig);
$articlesAssetsUrl = $this->modx->getOption('articles.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/articles/');
$quipAssetsUrl = $this->modx->getOption('quip.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/quip/');
$connectorUrl = $articlesAssetsUrl . 'connector.php';
$articlesJsUrl = $articlesAssetsUrl . 'js/';
$this->addJavascript($managerUrl . 'assets/modext/util/datetime.js');
$this->addJavascript($managerUrl . 'assets/modext/widgets/element/modx.panel.tv.renders.js');
$this->addJavascript($managerUrl . 'assets/modext/widgets/resource/modx.grid.resource.security.js');
$this->addJavascript($managerUrl . 'assets/modext/widgets/resource/modx.panel.resource.tv.js');
$this->addJavascript($managerUrl . 'assets/modext/widgets/resource/modx.panel.resource.js');
$this->addJavascript($managerUrl . 'assets/modext/sections/resource/update.js');
$this->addJavascript($articlesJsUrl . 'articles.js');
$this->addJavascript($articlesJsUrl . 'extras/combo.js');
$this->addJavascript($articlesJsUrl . 'extras/tagfield.js');
$this->addCss($quipAssetsUrl . 'css/mgr.css');
$this->addJavascript($quipAssetsUrl . 'js/quip.js');
$this->addJavascript($quipAssetsUrl . 'js/widgets/comments.grid.js');
$this->addHtml('<script type="text/javascript">
Ext.onReady(function() {
Quip.config = ' . $this->modx->toJSON(array()) . ';
Quip.config.connector_url = "' . $quipAssetsUrl . 'connector.php";
Quip.request = ' . $this->modx->toJSON($_GET) . ';
});
</script>');
$this->addLastJavascript($articlesJsUrl . 'article/update.js');
$this->addHtml('
<script type="text/javascript">
// <![CDATA[
Articles.assets_url = "' . $articlesAssetsUrl . '";
Articles.connector_url = "' . $connectorUrl . '";
MODx.config.publish_document = "' . $this->canPublish . '";
MODx.onDocFormRender = "' . $this->onDocFormRender . '";
MODx.ctx = "' . $this->resource->get('context_key') . '";
Ext.onReady(function() {
MODx.load({
xtype: "articles-page-article-update"
,resource: "' . $this->resource->get('id') . '"
,record: ' . $this->modx->toJSON($this->resourceArray) . '
,publish_document: "' . $this->canPublish . '"
,preview_url: "' . $this->previewUrl . '"
,locked: ' . ($this->locked ? 1 : 0) . '
,lockedText: "' . $this->lockedText . '"
,canSave: ' . ($this->canSave ? 1 : 0) . '
,canEdit: ' . ($this->canEdit ? 1 : 0) . '
,canCreate: ' . ($this->canCreate ? 1 : 0) . '
,canDuplicate: ' . ($this->canDuplicate ? 1 : 0) . '
,canDelete: ' . ($this->canDelete ? 1 : 0) . '
,show_tvs: ' . (!empty($this->tvCounts) ? 1 : 0) . '
,mode: "update"
});
});
// ]]>
</script>');
/* load RTE */
$this->loadRichTextEditor();
}
示例3: test_multilingual_getting_an_specific_locale
public function test_multilingual_getting_an_specific_locale()
{
$Article = new Article();
$this->assertTrue($Article =& $Article->findFirstBy('en_headline', 'New PHP Framework released'));
$this->assertEqual($Article->get('excerpt_limit', 'en'), 7);
$this->assertEqual($Article->get('excerpt_limit', 'es'), 3);
$this->assertEqual($Article->getAttribute('excerpt_limit', 'en'), 7);
$this->assertEqual($Article->getAttribute('excerpt_limit', 'es'), 3);
$this->assertEqual($Article->get('headline', 'en'), 'New PHP Framework released');
$this->assertEqual($Article->get('headline', 'es'), 'Se ha liberado un nuevo Framework para PHP');
$this->assertEqual($Article->getAttribute('headline', 'en'), 'New PHP Framework released');
$this->assertEqual($Article->getAttribute('headline', 'es'), 'Se ha liberado un nuevo Framework para PHP');
$this->assertEqual($Article->get('headline'), 'New PHP Framework released');
$this->assertEqual($Article->getAttribute('headline'), 'New PHP Framework released');
$this->assertEqual($Article->getAttributeLocales('headline'), array('en' => 'New PHP Framework released', 'es' => 'Se ha liberado un nuevo Framework para PHP'));
}
示例4: detail
function detail($url)
{
$urlcat = $this->uri->segment(1);
$category = new Newscatalogue();
$category->where(array('recycle' => 0, 'name_none' => $urlcat))->get();
if (!$category->exists()) {
show_404();
}
$dis['category'] = $category;
$url = geturlfromuri($this->uri->segment(2));
$news = new Article();
$news->where(array('title_none' => $url, 'recycle' => 0));
$news->get();
if (!$news->exists()) {
show_404();
}
$dis['news'] = $news;
$this->page_title = $news->title_vietnamese;
$this->page_description = $news->short_vietnamese;
$this->page_keyword = $news->tag;
//related news
$related_news = new Article();
$related_news->where('recycle', 0);
$related_news->where('newscatalogue_id', $news->newscatalogue_id);
$related_news->where("id !=", $news->id);
$related_news->order_by('created', 'DESC');
$related_news->get_paged(0, 10, TRUE);
$dis['related_news'] = $related_news;
$dis['base_url'] = base_url();
$dis['view'] = 'front/newsother/news_de';
$this->viewfront($dis);
}
示例5: get
public function get($id = 0, $useCache = true)
{
if (!$id) {
$id =& $this->id;
}
if ($useCache && ($cache = Cache::get($id))) {
return $cache;
}
parent::get($id, !USE_CACHE);
$this->photos = array();
$i = 0;
if (!is_array($this->files['photo'])) {
return $this;
}
foreach ($this->files['photo'] as &$f) {
$f->main =& Image::createThumbnail($f->name, $this->folder->config['imgWidth']);
$f->thumb =& Image::createThumbnail($f->name, $this->folder->config['imgThumbWidth']);
if (++$i == 1) {
$f->fpthumb =& Image::createThumbnail($f->name, $this->folder->config['fpThumbWidth']);
}
$this->photos[] = $f;
}
if ($this->pub_on > 0) {
Cache::set($id, $this);
}
return $this;
}
示例6: detail
function detail($title_none = NULL)
{
$title_none = $this->uri->segment(3);
$arrTitle = explode('.', $title_none);
if ($arrTitle[1] == '' || $arrTitle[1] != 'html') {
redirect('');
}
$title_none = $arrTitle[0];
$news = new Article();
$news->where('title_none', $title_none);
$news->get();
//print_r($this->db->last_query());exit();
if (!$news->exists()) {
show_404();
}
$dis['news'] = $news;
//related news
$related_news = new Article();
$related_news->where('recycle', 0);
$related_news->where('newscatalogue_id', $news->newscatalogue_id);
$related_news->where("id !=", $news->id);
$related_news->order_by('created', 'DESC');
$related_news->get_paged(0, 10, TRUE);
$dis['related_news'] = $related_news;
$category = new Newscatalogue($news->newscatalogue_id);
$dis['category'] = $category;
$this->page_title = $news->{'title_vietnamese'};
$this->page_description = $news->short_vietnamese;
$this->page_keyword = $news->tag;
$dis['base_url'] = base_url();
$dis['link'] = base_url() . $_SERVER['REQUEST_URI'];
$dis['view'] = 'front/services/news_de';
$this->viewfront($dis);
}
示例7: show
public function show(SS_HTTPRequest $request)
{
$article_ID = $request->param('ID');
$article = Article::get()->byID($article_ID);
if (!$article) {
return $this->httpError(404, 'That article could not be found');
}
return array('Article' => $article, 'Title' => $article->Title);
}
示例8: getNewsByCategory
function getNewsByCategory($categoryID)
{
$CI =& get_instance();
$cat_news = new Article();
$cat_news->where(array('recycle' => 0));
$cat_news->where('newscatalogue_id', $categoryID);
$cat_news->order_by('created', 'desc');
$cat_news->get(4);
return $cat_news;
}
示例9: index
function index()
{
$articlecategories = new Articlecategory();
$this->template->set('res_articlecategories', $articlecategories->get());
$articles = new Article();
$this->template->set('res_articles', $articles->get());
$this->template->set('page_name', 'Artikel');
$this->template->current_view = 'content/articles/home';
$this->template->render();
}
示例10: get
public function get($id = 0, $useCache = true)
{
if (!$id) {
$id =& $this->id;
}
if ($useCache && ($cache = Cache::get($id))) {
return $cache;
}
parent::get($id, false);
$this->price = $this->getLastItem(PRICE);
if ($this->pub_on > 0) {
Cache::set($id, $this);
}
return $this;
}
示例11: manymany
public function manymany()
{
$article = Article::get()->first();
$tags = $article->Tags();
foreach ($tags as $tag) {
$articles = $tag->Articles();
$articles->toArray();
}
$content .= '$article = Article::get()->first(); <br>';
$content .= '$tags = $article->Tags(); <br>';
$content .= 'foreach ($tags as $tag) { <br>';
$content .= ' $articles = $tag->Articles(); <br>';
$content .= ' $articles->toArray();<br>';
return $this->customise(new ArrayData(array('Title' => "Performance: {$this->dbType} many many", 'Content' => $content)))->renderWith(array('PerformanceController', 'AppController'));
}
示例12: get
public function get($id = 0, $useCache = true)
{
if (!$id) {
$id =& $this->id;
}
if ($useCache && ($cache = Cache::get($id))) {
return $cache;
}
parent::get($id, false);
$this->video = @array_shift($this->files['video']);
$this->image = @array_shift($this->files['image']);
if ($this->pub_on > 0) {
Cache::set($id, $this);
}
return $this;
}
示例13: get
public function get($id = 0, $useCache = true)
{
if ($useCache && ($cache = Cache::get($id))) {
return $cache;
}
if (!$id) {
$id =& $this->id;
}
parent::get($id, false);
$this->question = $this->getLastItem(QUESTION);
$this->answer = $this->getLastItem(ANSWER);
$this->alias = $this->getLastItem(ALIAS);
if ($this->pub_on > 0) {
Cache::set($id, $this);
}
return $this;
}
示例14: get
public function get($id = 0, $useCache = true)
{
$_SESSION['vote'] =& $_SERVER['REQUEST_TIME'];
if (!$id) {
$id =& $this->id;
}
if ($useCache && ($cache = Cache::get($id))) {
return $cache;
}
parent::get($id, false);
$res =& self::$dbh->query('SELECT id, name FROM poll_opt WHERE article_id=? ORDER BY id', array($this->id));
while ($row =& $res->fetchRow()) {
$k = $row['id'];
$this->options[$k] = $row['name'];
}
if ($this->pub_on > 0) {
Cache::set($id, $this);
}
return $this;
}
示例15: getMonth
public function getMonth()
{
$key = "GENRE_TRENDS_MONTH_" . $this->genre;
if (MEMCACHE) {
$memcache = Zend_Registry::get('memcache');
$popular = $memcache->get($key);
}
if (empty($popular)) {
$popular = array_slice(Popular::genre('month', $this->genre, true), 0, 10);
foreach ($popular as $i => $row) {
$article = Article::get($row['post_id']);
$popular[$i] = new ArticlePresenter($article[0]);
}
if (MEMCACHE) {
if (count($popular) > 5) {
$memcache->set($key, $popular, 7200);
}
}
}
$this->view_data['month'] = $popular;
}