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


PHP HtmlElement::BuildHTML方法代码示例

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


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

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