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


PHP TPL::tpIni方法代码示例

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


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

示例1: renderWidget

 /**
  * Will render a requested widget;
  *
  * This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
  * platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
  * configuration options that control the way the widget functions or showns;
  *
  * Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
  * are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
  * the developer needs them;
  *
  * @param $objW The widget to render;
  * @return mixed Depends on the widget;
  */
 public function renderWidget(S $objW, A $objWA = NULL)
 {
     // Make an empty array if NULL ...
     if ($objWA == NULL) {
         $objWA = new A();
     }
     // XML & RSS: Do a switch ...
     switch ($objW) {
         case 'widgetXML':
             // Yo man ... woohoooooo ...
             foreach ($this->getPublishedArticles(new S('ORDER
             BY %objArticleTableFDatePublished DESC')) as $k => $v) {
                 // Set some requirements ...
                 $objDTE = date('Y-m-d', (int) $v[self::$objArticleTableFDatePublished]->toString());
                 $objLOC = URL::staticURL(new A(array(ARTICLES_ARTICLES_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objArticleTableFSEO], FRONTEND_ARTICLE_URL)));
                 // Get the (INNER) CHILD of every young SEO freak ...
                 $objURL = $objWA['objXML']->addCHILD(Frontend::XML_URL);
                 // Set the XML Sitemap kids ...
                 $objURL->addCHILD(Frontend::XML_LOCATION, $objLOC);
                 $objURL->addCHILD(Frontend::XML_LAST_MOD, $objDTE);
                 $objURL->addCHILD(Frontend::XML_CHANGE_FREQ, self::XML_SITEMAP_FREQUENCY);
                 $objURL->addCHILD(Frontend::XML_PRIORITY, self::XML_SITEMAP_PRIORITY);
             }
             // BK;
             break;
         case 'widgetRSS':
             // Yo man ... woohoooooo ...
             if ($_GET[FRONTEND_FEED_URL] == __CLASS__) {
                 // Get'em 30 ...
                 foreach ($this->getPublishedArticles(new S('ORDER BY %objArticleTableFDatePublished
                 DESC LIMIT 0, 30')) as $k => $v) {
                     // Set some requirements ...
                     $objDTE = date(DATE_RFC822, (int) $v[self::$objArticleTableFDatePublished]->toString());
                     $objLOC = URL::staticURL(new A(array(ARTICLES_ARTICLES_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objArticleTableFSEO], FRONTEND_ARTICLE_URL)));
                     $objDSC = $v[self::$objArticleTableFExcerpt]->entityEncode(ENT_QUOTES)->entityDecode(ENT_QUOTES)->stripTags();
                     $objTTL = $v[self::$objArticleTableFTitle];
                     // Get the (INNER) CHILD of every young SEO freak ...
                     $objURL = $objWA['objXML']->addCHILD(Frontend::RSS_ITEM);
                     // Set the RSS kids ...
                     $objURL->addCHILD(Frontend::RSS_TITLE, $objTTL);
                     $objURL->addCHILD(Frontend::RSS_LINK, $objLOC);
                     $objURL->addCHILD(Frontend::RSS_GUID, $objLOC);
                     $objURL->addCHILD(Frontend::RSS_PUBLISHED_DATE, $objDTE);
                     $objURL->addCHILD(Frontend::RSS_DESCRIPTION, $objDSC);
                 }
             }
             // BK;
             break;
     }
     // HTML: Do a switch ...
     switch ($objW) {
         case 'widgetCategoryList':
             // Set the template file ...
             if ($cId = TPL::tpIni($tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION), new I(180))) {
                 // Get the category to start from ...
                 if (isset($objWA['start_from_category'])) {
                     // Get the category LIST;
                     $objCategoryList = $this->getCategories(NULL, $objWA['start_from_category']);
                 } else {
                     // Get the category LIST;
                     $objCategoryList = $this->getCategories(NULL, NULL);
                 }
                 // Set the template file ...
                 TPL::tpSet($objCategoryList, new S('objCategoryList'), $tpF);
                 TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                 TPL::tpSet($this, new S('ART'), $tpF);
                 TPL::tpExe($tpF);
                 TPL::tpEnd($cId);
             }
             // BK;
             break;
         case 'widgetList':
             // Check some needed requirements ...
             if ($_GET[FRONTEND_SECTION_URL] == FRONTEND_ARTICLE_URL) {
                 // Set some requirements ...
                 $objPag = isset($_GET[ARTICLES_PAGE_URL]) ? $_GET[ARTICLES_PAGE_URL] : new S((string) 1);
                 if (isset($_GET[ARTICLES_ARTICLES_URL])) {
                     // Check that the article exists, before doing anything stupid ...
                     if ($this->checkArticleURLIsUnique($objURL = $_GET[ARTICLES_ARTICLES_URL])->toBoolean() == TRUE) {
                         // Make the proper header, at first ...
                         $this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
                         // Give me back my free hardcore, Quoth the server, '404' ...
                         $this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
                     } else {
                         // Update them views ...
                         $this->_Q(_QS('doUPDATE')->doToken('%table', self::$objArticleTable)->doToken('%condition', _S('%objArticleTableFViews = %objArticleTableFViews + 1
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Articles.php

示例2: renderWidget

    /**
     * Will render a requested widget;
     *
     * This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
     * platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
     * configuration options that control the way the widget functions or showns;
     *
     * Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
     * are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
     * the developer needs them;
     *
     * @param $objW The widget to render;
     * @return mixed Depends on the widget;
     */
    public function renderWidget(S $objW, A $objWA = NULL)
    {
        // Make an empty array if NULL ...
        if ($objWA == NULL) {
            $objWA = new A();
        }
        // XML & RSS: Do a switch ...
        switch ($objW) {
            case 'widgetXML':
                // Yo man ... woohoooooo ...
                foreach ($this->getApprovedAudioFiles(new S('ORDER
                BY %objAudioTableFUploadedDate DESC')) as $k => $v) {
                    // Set some requirements ...
                    $objDTE = date('Y-m-d', (int) $v[self::$objAudioTableFUploadedDate]->toString());
                    $objLOC = URL::staticURL(new A(array(AUDIO_ITEM_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objAudioTableFSEO], FRONTEND_AUDIO_URL)));
                    // Get the (INNER) CHILD of every young SEO freak ...
                    $objURL = $objWA['objXML']->addCHILD(Frontend::XML_URL);
                    // Set the XML Sitemap kids ...
                    $objURL->addCHILD(Frontend::XML_LOCATION, $objLOC);
                    $objURL->addCHILD(Frontend::XML_LAST_MOD, $objDTE);
                    $objURL->addCHILD(Frontend::XML_CHANGE_FREQ, self::XML_SITEMAP_FREQUENCY);
                    $objURL->addCHILD(Frontend::XML_PRIORITY, self::XML_SITEMAP_PRIORITY);
                }
                // BK;
                break;
            case 'widgetRSS':
                // Yo man ... woohoooooo ...
                if ($_GET[FRONTEND_FEED_URL] == __CLASS__) {
                    // Get'em 30 ...
                    foreach ($this->getApprovedAudioFiles(new S('ORDER BY %objAudioTableFUploadedDate
                    DESC LIMIT 0, 30')) as $k => $v) {
                        // Set some requirements ...
                        $objDTE = date(DATE_RFC822, (int) $v[self::$objAudioTableFUploadedDate]->toString());
                        $objLOC = URL::staticURL(new A(array(AUDIO_ITEM_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objAudioTableFSEO], FRONTEND_AUDIO_URL)));
                        $objTTL = $v[self::$objAudioTableFTitle]->appendString(_DCSP)->appendString($v[self::$objAudioTableFArtist])->appendString(_DCSP)->appendString($v[self::$objAudioTableFAlbum]);
                        $objDSC = $v[self::$objAudioTableFDescription]->entityEncode(ENT_QUOTES)->entityDecode(ENT_QUOTES)->stripTags();
                        // Get the (INNER) CHILD of every young SEO freak ...
                        $objURL = $objWA['objXML']->addCHILD(Frontend::RSS_ITEM);
                        // Set the RSS kids ...
                        $objURL->addCHILD(Frontend::RSS_TITLE, $objTTL);
                        $objURL->addCHILD(Frontend::RSS_LINK, $objLOC);
                        $objURL->addCHILD(Frontend::RSS_GUID, $objLOC);
                        $objURL->addCHILD(Frontend::RSS_PUBLISHED_DATE, $objDTE);
                        $objURL->addCHILD(Frontend::RSS_DESCRIPTION, $objDSC);
                    }
                }
                // BK;
                break;
        }
        // HTML: Do a switch ...
        switch ($objW) {
            case 'widgetCategoryList':
                // Set some requirements ...
                if (isset($objWA['cache_file'])) {
                    // Take the input;
                    $objCacheFile = $objWA['cache_file'];
                } else {
                    // Do cache me ...
                    $objCacheFile = new B(TRUE);
                }
                if (isset($objWA['cache_time'])) {
                    // Get the cache time from me;
                    $objCacheTime = $objWA['cache_time'];
                } else {
                    // Do a cache for: 6 hours;
                    $objCacheTime = new I(60 * 60 * 6);
                }
                // Set the template file ...
                if ($cId = TPL::tpIni($tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . TPL_EXTENSION), $objCacheTime, $objCacheFile)) {
                    // Get the category to start from ...
                    if (isset($objWA['start_from_category'])) {
                        // Get the category LIST;
                        $objCategoryList = $this->getCategories(NULL, $objWA['start_from_category']);
                    } else {
                        // Get the category LIST;
                        $objCategoryList = $this->getCategories(NULL, NULL);
                    }
                    // Set the template file ...
                    TPL::tpSet($objCategoryList, new S('objCategoryList'), $tpF);
                    TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
                    TPL::tpSet($this, new S('AUD'), $tpF);
                    TPL::tpExe($tpF);
                    TPL::tpEnd($cId);
                }
                // BK;
                break;
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Audio.php


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