当前位置: 首页>>代码示例>>PHP>>正文


PHP HtmlElement::Set方法代码示例

本文整理汇总了PHP中HtmlElement::Set方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlElement::Set方法的具体用法?PHP HtmlElement::Set怎么用?PHP HtmlElement::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlElement的用法示例。


在下文中一共展示了HtmlElement::Set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetLocations

 public function GetLocations()
 {
     # Create Location Drop-Down
     $this->CheckMyLocation();
     parent::SetQuery("SELECT * FROM `aggregate_deal_region` ORDER BY location ASC");
     $locations = parent::DoQuery();
     $locationLinks = array();
     parent::SetQuery("SELECT * FROM `aggregate_deal_region` WHERE aggregate_deal_region_id='{$this->localData["location_id"]}'");
     $cityInfo = parent::DoQuery();
     $first_city = $cityInfo[0]["location"];
     foreach ($locations as $location) {
         // location dropdowns
         $link_div = new HtmlElement('div');
         $link_div->Set('style', 'padding: 8px; padding-left: 20px;');
         $link_div->Set('onmouseover', 'this.style.backgroundColor=\'#794933\';');
         $link_div->Set('onmouseout', 'this.style.backgroundColor=\'transparent\';');
         $link = new HtmlElement('a');
         $link->Set('href', $this->localData["current_page"] . '?location_id=' . $location["location_id"]);
         $link->Set('class', 'city-dropdown-link');
         $link->Set('text', $location["location"]);
         $link_div->Inject($link);
         if ($location["location"] != $first_city) {
             // don't display the currently selected city
             $locationLinks[] = $link_div->ReturnData();
         }
     }
     $this->JsonOutput(array("first_city" => $first_city, "cities" => join("", $locationLinks)));
 }
开发者ID:jamesming,项目名称:find-my-monkey,代码行数:28,代码来源:Application.class.php

示例2: CreateRSS

 public function CreateRSS($query, $title_p, $link_p, $description_p)
 {
     // recent
     $rss_top = new HtmlElement('rss');
     $rss_top->Set('version', '2.0');
     $channel = new HtmlElement('channel');
     $title = new HtmlElement('title');
     $title->Set('text', $title_p);
     $link = new HtmlElement('link');
     $link->Set('text', $link_p);
     $description = new HtmlElement('description');
     $description->Set('text', $description_p);
     $language = new HtmlElement('language');
     $language->Set('text', 'en-us');
     $webmaster = new HtmlElement('webMaster');
     $webmaster->Set('text', 'admin@findmymonkey.com');
     $channel->Inject($title);
     $channel->Inject($link);
     $channel->Inject($description);
     $channel->Inject($language);
     $channel->Inject($webmaster);
     parent::SetQuery($query);
     $exists = parent::CountDBResults();
     if ($exists) {
         // records exist
         $num = 0;
         $results = parent::DoQuery();
         while ($results[$num]) {
             // loop through results
             $item = new HtmlElement('item');
             $title = new HtmlElement('title');
             $title->Set('text', $results[$num]["one_liner"]);
             $link = new HtmlElement('link');
             $append_to_url[] = "offer_id={$results[$num]["offer_id"]}";
             $offer_url = "offer-details";
             if ($this->localData["aff_id"]) {
                 // affiliate set
                 $append_to_url[] = "aff_id={$this->localData["aff_id"]}";
             }
             if ($this->localData["location_id"]) {
                 // location id set
                 //$append_to_url[] = "location_id={$this->localData["location_id"]}";
                 $offer_url = "offer-details";
             }
             if (sizeOf($append_to_url) > 0) {
                 // append parameters to URL
                 $appended_url_string = "?" . join("&", $append_to_url);
             }
             $link->Set('text', 'http://www.findmymonkey.com/' . $offer_url . $appended_url_string);
             parent::SetQuery("SELECT * FROM `table_offerlocations`,`table_locations` WHERE \r\n\t\t\t\t`table_offerlocations`.`location_id`=`table_locations`.`location_id`\r\n\t\t\t\tAND\r\n\t\t\t\t`table_offerlocations`.`offer_id`='{$results[$num]["offer_id"]}'");
             $offerLocations = parent::DoQuery();
             $locationArr = array();
             foreach ($offerLocations as $offerLocation) {
                 // loop through each location
                 $locationArr[] = $offerLocation["location"];
             }
             $locationStr = join(", ", $locationArr);
             $description = new HtmlElement('description');
             $description->Set('text', $results[$num]["description"] . htmlentities("<br/><br/>A <b>\${$results[$num]["value"]} value</b> for <i>only</i> <b>\${$results[$num]["price"]}</b>" . " - Limit: <b>{$results[$num]["limit"]}</b>" . "<br/><br/>Offer Available for these Locations: {$locationStr}<br/><br/>" . "", ENT_QUOTES));
             $pubDate = new HtmlElement('pubDate');
             $pubDate->Set('text', date("M-d-Y H:i:s", time()));
             $item->Inject($title);
             $item->Inject($link);
             $item->Inject($description);
             $item->Inject($pubDate);
             $channel->Inject($item);
             $num += 1;
         }
         $rss_top->Inject($channel);
         echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
         echo $rss_top->BuildHTML();
     }
 }
开发者ID:jamesming,项目名称:find-my-monkey,代码行数:73,代码来源:rss.php


注:本文中的HtmlElement::Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。