【问题标题】:Set templavoila template with typoscript用排版设置 templavoila 模板
【发布时间】:2013-01-29 13:47:07
【问题描述】:

是否可以使用打字稿设置页面的模板?

【问题讨论】:

    标签: typo3 typoscript templavoila


    【解决方案1】:

    我已经解决了:

    includeLibs.lang = fileadmin/user_tvtest.php
    
    page.1 = USER_INT
    page.1.userFunc = user_tvtest->main
    
    page.10 = USER_INT
    page.10.userFunc = tx_templavoila_pi1->main_page
    page.10.disableExplosivePreview = 1
    

    在文件管理员/user_tvtest.php 中:

    class user_tvtest
    {
    
        function main($content, $conf)
        {
    
            if (is_mobile()) 
            {
    
                $GLOBALS['TSFE']->page['tx_templavoila_to'] = 7;
                //$GLOBALS['TSFE']->page['tx_templavoila_ds'] = 7;
    
            }
    
        }
    
    }
    

    http://daschmi.de/templavoila-template-domainbezogen-umschalten-gleicher-seitenbaum/

    【讨论】:

      【解决方案2】:

      看看TemplaVoila是如何配置页面的:

      page = PAGE
      page.typeNum = 0
      page.10 = USER
      page.10.userFunc = tx_templavoila_pi1->main_page
      page.shortcutIcon = {$faviconPath}
      

      他们通过page.userFunc调用tx_templavoila_pi1类的main_page函数:

      /**
       * Main function for rendering of Page Templates of TemplaVoila
       *
       * @param   string      Standard content input. Ignore.
       * @param   array       TypoScript array for the plugin.
       * @return  string      HTML content for the Page Template elements.
       */
      function main_page($content,$conf)    {
          $this->initVars($conf);
      
              // Current page record which we MIGHT manipulate a little:
          $pageRecord = $GLOBALS['TSFE']->page;
      
              // Find DS and Template in root line IF there is no Data Structure set for the current page:
          if (!$pageRecord['tx_templavoila_ds'])  {
              foreach($GLOBALS['TSFE']->tmpl->rootLine as $pRec)  {
                  if ($pageRecord['uid'] != $pRec['uid']) {
                      if ($pRec['tx_templavoila_next_ds'])    {   // If there is a next-level DS:
                          $pageRecord['tx_templavoila_ds'] = $pRec['tx_templavoila_next_ds'];
                          $pageRecord['tx_templavoila_to'] = $pRec['tx_templavoila_next_to'];
                      } elseif ($pRec['tx_templavoila_ds'])   {   // Otherwise try the NORMAL DS:
                          $pageRecord['tx_templavoila_ds'] = $pRec['tx_templavoila_ds'];
                          $pageRecord['tx_templavoila_to'] = $pRec['tx_templavoila_to'];
                      }
                  } else break;
              }
          }
      
              // "Show content from this page instead" support. Note: using current DS/TO!
          if ($pageRecord['content_from_pid']) {
              $ds = $pageRecord['tx_templavoila_ds'];
              $to = $pageRecord['tx_templavoila_to'];
              $pageRecord = $GLOBALS['TSFE']->sys_page->getPage($pageRecord['content_from_pid']);
              $pageRecord['tx_templavoila_ds'] = $ds;
              $pageRecord['tx_templavoila_to'] = $to;
          }
      
          return $this->renderElement($pageRecord, 'pages');
      }
      

      此功能检查当前页面或通过根线 (TSFE) 搜索配置的页面模板。该脚本根本不检查任何 TypoScript 设置,所以我认为 TemplaVoila 目前不支持。

      用一个自定义函数来扩展这个类应该不会太难,它将检查一些 TypoScript 设置。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-07-31
        • 1970-01-01
        • 1970-01-01
        • 2017-02-08
        • 1970-01-01
        • 2011-09-28
        • 1970-01-01
        相关资源
        最近更新 更多