本文整理汇总了PHP中Article::order_by方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::order_by方法的具体用法?PHP Article::order_by怎么用?PHP Article::order_by使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::order_by方法的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: 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);
}
示例3: 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);
}
示例4: 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;
}
示例5: index
function index($category_id = FALSE)
{
$articles = new Article();
if ($category_id) {
$category = new Category($category_id);
$articles->where("category_id in (select id from categories where lft >= " . $category->lft . " and rgt <= " . $category->rgt . " and module = '" . $category->module . "')");
}
$data['articles'] = $articles->order_by('id', 'desc')->get_page(limit());
$this->template->append_metadata(js_lightbox());
$this->template->build('admin/article_index', $data);
}
示例6: Article
</p>
</a>
</div>
</div>
<?php
}
}
?>
</div>
<!-- end cotphainoibat-->
</div>
<?php
foreach ($this->newsCate as $row) {
$news = new Article();
$news->where(array('recycle' => 0, 'newscatalogue_id' => $row->id));
$news->order_by('id', 'desc');
$news->get(5);
$newsFirst = $news->limit(1);
?>
<!--tin con 1 -->
<div class="tinthitruong">
<p style="font-size:16px; font-weight:bold; color:#FFFFFF; margin-left:12px; margin-top:8px;">
<a style="color: #FFF;" href="<?php
echo $base_url . 'tin-tuc/' . $row->name_none;
?>
">
<?php
echo $row->name_vietnamese;
?>
</a>
</p>
示例7: getAllArticles
static function getAllArticles(&$message, $forceall = false, $orderby = "id")
{
if (!$forceall && isset($_GET['type']) && $_GET['type'] === "unpublished") {
if (Auth::user()->type != 1) {
$message = "Showing all unpublished by you";
return Article::where('author_id', '=', Auth::user()->id)->where('status', '=', '0')->order_by($orderby, 'desc');
} else {
$message = "Showing all unpublished Articles (by all authors)";
return Article::where('status', '=', '0')->order_by($orderby, 'desc');
}
} else {
if (!$forceall && Auth::user()->type != 1) {
$message = "Showing all articles posted by you";
return Article::where('author_id', '=', Auth::user()->id)->order_by($orderby, 'desc');
} else {
$message = "Showing all articles";
return Article::order_by($orderby, 'desc');
}
}
}
示例8: helpCenter
function helpCenter()
{
$news = new Article();
$news->where('newscatalogue_id', 65);
$news->order_by('id', 'desc');
$news->get_iterated();
$dis['news'] = $news;
$this->page_title = "Trợ giúp - " . $this->page_title;
$dis['base_url'] = base_url();
$dis['view'] = 'helpCenter';
$this->viewfront($dis);
}
示例9: arrange_position_home
private function arrange_position_home()
{
$o = new Article();
$o->where('home_hot', 1);
$o->order_by('home_hot_position', 'asc');
$o->get();
$c = $o->count();
$i = 1;
foreach ($o as $row) {
$i++;
$row->home_hot_position = $i;
$row->save();
}
}
示例10: getProject
function getProject()
{
//$type = new Estatetype($this->input->post('typeId'));
//$category = new Estatecatalogue($type->estatecatalogue_id);
$o = new Article();
$o->where('recycle', 0);
$o->where('estatecity_id', $this->input->post('provincesId'));
$o->order_by('title_vietnamese', 'asc');
$o->get();
$option = '<option value="">Chọn Dự án</option>';
foreach ($o as $row) {
if ($row->id == $this->input->post('priceSelected')) {
$option .= '<option selected="selected" value=' . $row->id . '>' . $row->title_vietnamese . '</option>';
} else {
$option .= '<option value=' . $row->id . '>' . $row->title_vietnamese . '</option>';
}
}
echo $option;
die;
}
示例11: postGuide
function postGuide()
{
$news = new Article();
$news->where(array('recycle' => 0, 'newscatalogue_id' => 90))->get_iterated();
if (!$news->exists()) {
show_404();
}
$dis['news'] = $news;
// get news view most
$newViewMost = new Article();
$newViewMost->where('recycle', 0);
$newViewMost->where_in('newscatalogue_id', $this->listAllCat);
$newViewMost->order_by('view_count', 'desc');
$newViewMost->get(10);
$dis['newViewMost'] = $newViewMost;
$this->page_title = "Hướng dẫn đăng tin - " . $this->page_title;
$this->menu_active = 'home';
$dis['base_url'] = base_url();
$dis['view'] = 'front/postGuide';
$this->viewfront($dis);
}
示例12: Article
<div id="footer_f">
<div class="title">
<div class="f_hotline txt fl">Tin tức</div>
<div class="f_accessories txt fl">Sản phẩm</div>
<div class="txt fl">liên kết</div>
<div class="clr"></div>
</div>
<div class="footer_links">
<div class="f_hotline f_height fl">
<?php
$footerNews = new Article();
$footerNews->where('recycle', 0);
$footerNews->where('active', 1);
$footerNews->where('newscatalogue_id', 58);
$footerNews->order_by('created', 'DESC');
$footerNews->get_paged(0, 5, TRUE);
?>
<?php
foreach ($footerNews as $row) {
?>
<div style="height: 21px;width: 185px;overflow: hidden;float:left;clear:both;"><a href="<?php
echo $base_url . "tin-tuc/d/" . $row->{'title_none'};
?>
" title="<?php
echo $row->title_vietnamese;
?>
">» <?php
echo $row->title_vietnamese;
?>
</a></div>
示例13: 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, 'parentcat_id' => NULL))->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()) {
show_404();
}
$dis['news'] = $news;
$tag = $news->tag;
$dis['tag'] = explode(',', $tag);
$news->view_count = $news->view_count++;
$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, 10, TRUE);
$dis['related_news'] = $related_news;
$this->page_title = $news->{'title_vietnamese'} . ' | Dự án ' . $category->name_vietnamese . ' ' . $news->{'title_vietnamese'} . ' | SotayNhadat.vn';
$this->page_description = $news->short_vietnamese;
$this->page_keyword = $news->tag;
$this->isRobotFollow = 1;
$dis['base_url'] = base_url();
$dis['view'] = 'front/project/news_de';
$this->viewfront($dis);
}
示例14: cauhinh
function MY_Controller()
{
parent::Controller();
$this->load->library('enum');
$this->load->config('fireignition');
$this->load->helper('language');
$this->lang->load('site');
$this->load->library('hit_counter');
$this->load->library('FirePHP');
if ($this->config->item('fireignition_enabled')) {
if (floor(phpversion()) < 5) {
log_message('error', 'PHP 5 is required to run fireignition');
} else {
$this->load->library('FirePHP');
}
} else {
$this->load->library('Firephp_fake');
$this->firephp =& $this->firephp_fake;
}
//redirect from old website
$this->redirectList();
$cauhinh = new cauhinh();
$cauhinh->get();
$this->cauhinh = $cauhinh;
if ($this->uri->segment(1, "") == "admin") {
$this->logged_in_user = $this->_get_user();
$this->admin = $this->config->item('admin');
$this->admin_url = $this->config->item('admin_url');
$this->admin_images = base_url() . "images/admin/";
//LOAD HELPER
$this->load_admin_resource();
//check maintenance admin , only webmaster can login
$this->resetNewsViewMost();
} else {
//check login user
//$this->flogged_in_user=$this->_fget_user();
$this->isCache = true;
$this->userLoginFlag = 0;
$userLogin = $this->session->userdata('userLogin');
$userToken = $this->session->userdata('userToken');
$customer = new Customer();
$customer->get_by_username($userLogin);
if ($customer->exists() && md5($customer->id) == trim($userToken)) {
$loginUsername = $customer->username;
$this->customer = $customer;
if ($this->session->userdata('userloginFlag') == "1") {
$this->userLoginFlag = 1;
$this->session->set_userdata('userloginFlag', "0");
}
} else {
$loginUsername = "";
}
$this->loginUsername = $loginUsername;
$this->loginUser = $customer;
$this->page_title = getconfigkey("defaultPageTitle");
$this->load->helper('language');
$this->show_analytic = TRUE;
$this->page_keyword = getconfigkey("defaultKeyword");
$this->page_description = getconfigkey("defaultDescription");
$this->isRobotFollow = true;
//------------------------------------------------
// get data handler
//------------------------------------------------
$listAllCat = array();
$newsCate = new Newscatalogue();
$newsCate->order_by('position');
$newsCate->where(array('recycle' => 0, 'parentcat_id' => 58));
$newsCate->get_iterated();
$this->newsCate = $newsCate;
foreach ($newsCate as $row) {
array_push($listAllCat, $row->id);
}
/*Get all business cat*/
$businessCat = new Newscatalogue();
$businessCat->order_by('position');
$businessCat->where(array('recycle' => 0, 'parentcat_id' => 91));
$businessCat->get_iterated();
$this->businessCat = $businessCat;
$guideCate = new Newscatalogue();
$guideCate->order_by('position');
$guideCate->where(array('recycle' => 0, 'parentcat_id' => 76));
$guideCate->get_iterated();
$this->guideCate = $guideCate;
foreach ($guideCate as $row) {
array_push($listAllCat, $row->id);
}
$this->listAllCat = $listAllCat;
$projectsCate = new Newscatalogue();
$projectsCate->order_by('position');
$projectsCate->where(array('recycle' => 0, 'parentcat_id' => 83));
$projectsCate->get_iterated();
$this->projectsCate = $projectsCate;
$arrayCateNewsId = array();
foreach ($this->projectsCate as $row) {
$arrayCateNewsId[] = $row->id;
}
$this->arrCateProject = $arrayCateNewsId;
// project hot
$projectHot = new Article();
$projectHot->where('recycle', 0);
//.........这里部分代码省略.........
示例15: editFree
function editFree($id = 0)
{
$estate = new estate($id);
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$this->load->helper('remove_vn_helper');
$this->load->library('file_lib');
$estate->estatecity_id = $this->input->post('estatecity_id');
$estate->estatedistrict_id = $this->input->post('estatedistrict_id');
$estate->estateward_id = $this->input->post('estateward_id');
$estate->estatedirection_id = $this->input->post('estatedirection_id');
$estate->estatecatalogue_id = $this->input->post('estatecatalogue_id');
$estate->estatetype_id = $this->input->post('estatetype_id');
$estate->estatearea_id = $this->input->post('estatearea_id');
$estate->estateprice_id = $this->input->post('estateprice_id');
$estate->address = $this->input->post('address');
$estate->isArea = $this->input->post('IsArea');
$estate->area = $this->input->post('area');
$estate->legally = $this->input->post('legally');
$estate->isPrice = $this->input->post('IsPrice');
$estate->price_text = $this->input->post('price_text');
$estate->estatedirection_id = $this->input->post('estatedirection_id');
$estate->title = $this->input->post('title');
$estate->description = $this->input->post('description');
$estate->price_text = $this->input->post('price_text');
$estate->area_text = $this->input->post('area_text');
$estate->article_id = $this->input->post('article_id');
$estate->price_type = $this->input->post('price_type');
if ($estate->isVip == 0) {
$estate->updateTime = date('Y-m-d H:i:s');
} else {
$estate->created = $estate->created;
$estate->updated = $estate->updated;
$estate->updateTime = date('Y-m-d H:i:s');
}
$estate->name_contact = $this->input->post('name_contact');
$estate->address_contact = $this->input->post('address_contact');
$estate->phone_contact = $this->input->post('phone_contact');
$estate->mobile_contact = $this->input->post('mobile_contact');
$estate->email_contact = $this->input->post('email_contact');
$estate->tag = $this->input->post('tag');
$tags = remove_vn($this->input->post('tag') . ' ' . $this->input->post('title'));
$tags = explode('-', $tags);
$estate->tag_search = implode(' ', $tags);
$estate->title_none = remove_vn($this->input->post('title')) . $estate->code;
// Change images default
if ($_FILES['image']['name'] != "") {
$folder = 'img/project/';
$dataupload = $this->file_lib->upload('image', $folder, $rename_file = true);
if (!is_array($dataupload)) {
flash_message('error', $dataupload);
$estate->photo = '';
} else {
$estate->photo = $folder . $dataupload['file_name'];
}
}
if ($estate->save()) {
flash_message('success', 'Bản tin đã được thay đổi thành công.');
redirect($this->admin_url . 'estates/listFree/');
//redirect($this->admin_url.'estates/editFree/'.$estate->id);
} else {
flash_message('error', 'Đã có lỗi xãy ra !');
//redirect($this->admin_url.'estates/listFree/');
redirect($this->admin_url . 'estates/editFree/' . $estate->id);
}
}
$estateCategory = new Estatecatalogue();
$estateCategory->get_iterated();
$dis['estateCategory'] = $estateCategory;
$estateType = new Estatetype();
$estateType->order_by('id');
$estateType->where('estatecatalogue_id', $estate->estatecatalogue_id);
$estateType->get_iterated();
$dis['estateType'] = $estateType;
$estateAreas = new Estatearea();
$estateAreas->order_by('position');
$estateAreas->get_iterated();
$dis['estateAreas'] = $estateAreas;
$estateDirection = new Estatedirection();
$estateDirection->order_by('id');
$estateDirection->get_iterated();
$dis['estateDirection'] = $estateDirection;
$estatePrices = new Estateprice();
$estatePrices->where('estatecatalogue_id', $estate->estatecatalogue_id);
$estatePrices->order_by('position', 'asc');
$estatePrices->get_iterated();
$dis['estatePrices'] = $estatePrices;
$estateCities = new Estatecity();
$estateCities->order_by('id');
$estateCities->get_iterated();
$dis['estateCities'] = $estateCities;
$estateDictricts = new Estatedistrict();
$estateDictricts->where('estatecity_id', $estate->estatecity_id);
$estateDictricts->order_by('position', 'asc');
$estateDictricts->get_iterated();
$dis['estateDictricts'] = $estateDictricts;
$estateWards = new Estateward();
$estateWards->where('estatedistrict_id', $estate->estatedistrict_id);
$estateWards->order_by('position');
$estateWards->get_iterated();
$dis['estateWards'] = $estateWards;
//.........这里部分代码省略.........