當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model_Ad::getAdList方法代碼示例

本文整理匯總了PHP中Model_Ad::getAdList方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model_Ad::getAdList方法的具體用法?PHP Model_Ad::getAdList怎麽用?PHP Model_Ad::getAdList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Model_Ad的用法示例。


在下文中一共展示了Model_Ad::getAdList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: feedAction

 public function feedAction()
 {
     $woeid = $this->_request->getParam('woeid');
     $ad_type = $this->_request->getParam('ad_type');
     $status = $this->_request->getParam('status');
     $modelAd = new Model_Ad();
     $this->ads = $modelAd->getAdList($woeid, $ad_type, $status, 35);
     $rss['title'] = $this->view->translate($ad_type) . ' ' . $this->view->translate((string) $status) . ' - ' . $this->_helper->woeid->name($woeid, $this->lang) . ' | nolotiro.org';
     $rss['link'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/rss/feed/woeid/' . $woeid . '/ad_type/' . $ad_type . '/status/' . $status;
     $rss['charset'] = 'utf-8';
     $rss['description'] = 'nolotiro.org - ' . $this->_helper->woeid->name($woeid, $this->lang);
     $rss['language'] = $this->lang;
     $rss['generator'] = 'nolotiro.org';
     $rss['entries'] = array();
     foreach ($this->ads as $value) {
         $entry = array();
         $entry['title'] = $value['title'];
         $entry['link'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/ad/' . $value['id'] . '/' . $this->view->slugTitle($value['title']);
         $entry['description'] = $this->view->escapeEmail($value['body']);
         $entry['lastUpdate'] = strtotime($value['date_created']);
         $rss['entries'][] = $entry;
     }
     $feedObj = Zend_Feed::importArray($rss, 'rss');
     return $feedObj->send();
 }
開發者ID:Arteaga2k,項目名稱:nolotiro,代碼行數:25,代碼來源:RssController.php

示例2: listAction

 public function listAction()
 {
     $this->view->userRole = $this->_helper->checkUserRole->check();
     $this->view->location = $this->_helper->checklocation->check();
     $woeid = $this->_request->getParam('woeid');
     $this->view->ad_type = $ad_type = $this->_request->getParam('ad_type');
     if ($ad_type == 'give') {
         $this->view->page_title .= $this->view->translate('give') . ' ' . $this->view->translate('second hand') . ' ';
         $type = 'give';
     } elseif ($ad_type == 'want') {
         $this->view->page_title .= $this->view->translate('want') . ' ' . $this->view->translate('second hand') . ' ';
         $type = 'want';
     } else {
         //dont accept other values than give/want
         $this->getResponse()->setHttpResponseCode(404);
         $this->_helper->_flashMessenger->addMessage($this->view->translate('this url does not exist'));
         $this->_redirect('/' . $this->lang . '/woeid/' . $this->location . '/give', array('code' => 301));
     }
     $this->view->page_title .= ' ' . $this->view->translate('free') . ' ';
     $this->view->status = $status = $this->_request->getParam('status');
     $f = new Zend_Filter();
     $f->addFilter(new Zend_Filter_HtmlEntities());
     $status = $f->filter($status);
     if ($status) {
         $this->view->page_title .= $this->view->translate($status) . ' ';
     } else {
         $status = 'available';
     }
     $model = new Model_Ad();
     $this->view->woeid = $woeid;
     $this->view->ad = $model->getAdList($woeid, $ad_type, $status);
     $this->view->woeidName = $this->_helper->woeid->name($woeid, $this->lang);
     $short = explode(',', $this->view->woeidName);
     $this->view->woeidNameShort = ' ' . $this->view->translate('in') . ' ' . $short[0];
     //add meta description to head
     $this->view->metaDescription = $this->view->translate($type) . ' ' . $this->view->woeidNameShort . '. ' . $this->view->translate('nolotiro.org is a website where you can give away things you no longer want or no longer need to pick them up other people who may serve or be of much use.');
     //add link rel canonical , better seo
     $this->view->canonicalUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/woeid/' . $woeid . '/' . $ad_type . '/status/' . $status;
     //add the link to the proper rss to layout
     $this->view->headLink()->appendAlternate('http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/rss/feed/woeid/' . $woeid . '/ad_type/' . $ad_type . '/status/' . $status, 'application/rss+xml', $this->view->woeidName . ' - ' . $this->view->translate((string) $type));
     if (empty($this->view->ad)) {
         $this->view->suggestIP = $this->_helper->getLocationGeoIP->suggest();
         $this->view->similarLocations = $this->_helper->similarLocations->suggest($this->view->woeidName, $this->lang);
     }
     //TODO , this sucks, do a better way to not show invalid woeids or null
     if (empty($woeid) || $woeid < 10 || $woeid == 29370606) {
         //29370606 españa town
         $this->_helper->_flashMessenger->addMessage($this->view->translate('This location is not a valid town. Please, try again.'));
         $this->_redirect('/' . $this->lang . '/location/change', array('code' => 301));
     }
     //set the location name reg var from the woeid helper
     $aNamespace = new Zend_Session_Namespace('Nolotiro');
     $aNamespace->locationName = $this->view->woeidName;
     $this->view->page_title .= $this->view->woeidName;
     //paginator
     $page = $this->_getParam('page');
     if ($page) {
         $this->view->page_title .= ' - ' . $this->view->translate('page') . ' ' . $page;
     }
     $paginator = Zend_Paginator::factory($this->view->ad);
     $paginator->setDefaultScrollingStyle('Elastic');
     $paginator->setItemCountPerPage(20);
     $paginator->setCurrentPageNumber($page);
     $this->view->paginator = $paginator;
 }
開發者ID:Arteaga2k,項目名稱:nolotiro,代碼行數:65,代碼來源:AdController.php


注:本文中的Model_Ad::getAdList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。