0

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

4

2 回答 2

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

在 fileadmin/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/

于 2014-10-09T08:10:21.340 回答
0

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

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

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

/**
 * 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 设置的自定义函数扩展此类应该不会太难。

于 2013-01-29T15:04:28.207 回答