2013-05-29 37 views
3

我遇到了extbase/fluid擴展創建的奇怪問題。 我使用TYPO3 6.1TYPO3 Extbase後端模塊。模板路徑問題

我已經在我的開發服務器(相同的配置/硬件,然後產品)後端模塊進行了擴展。該模塊工作完美地與路徑模板:

myext /資源/個人/後端/模板
myext /資源/個人/後端/佈局
myext /資源/個人/後端/局部模板

在此之後,我在ext管理器中下載了我的擴展的zip文件,然後在prod服務器上安裝了安裝程序。現在我無法使用我的擴展,因爲模塊找不到模板。 我以相同的方式配置了擴展名。模板處於正確的路徑。

我考到我的文件夾移動到上一層:

myext /資源/個人/模板
myext /資源/個人/佈局
myext /資源/私有/局部模板

有了這個它可以工作,但在模塊配置中,我指定了「Backend /」文件夾的正確路徑。

我不會移動我的文件夾在私人文件夾中,我希望它在私人/後端文件夾中運行。

我已將擴展靜態模板包含到網站根TS模板中。

這裏的常數:

module.tx_myext { 
    view { 
     # cat=module.tx_myext/file; type=string; label=Path to template root (BE) 
     templateRootPath = EXT:wng_myext/Resources/Private/Backend/Templates/ 
     # cat=module.tx_myext/file; type=string; label=Path to template partials (BE) 
     partialRootPath = EXT:wng_myext/Resources/Private/Backend/Partials/ 
     # cat=module.tx_myext/file; type=string; label=Path to template layouts (BE) 
     layoutRootPath = EXT:wng_myext/Resources/Private/Backend/Layouts/ 
    } 
    persistence { 
     # cat=module.tx_myext//a; type=string; label=Default storage PID 
     storagePid = 
    } 
} 

而這裏的設置:

module.tx_myext { 
    persistence { 
     storagePid = {$module.tx_myext.persistence.storagePid} 
    } 
    view { 
     templateRootPath = {$module.tx_myext.view.templateRootPath} 
     partialRootPath = {$module.tx_myext.view.partialRootPath} 
     layoutRootPath = {$module.tx_myext.view.layoutRootPath} 
    } 
} 

回答

2

試圖清理所有緩存,即使在typo3temp /核心/緩存(或類似的東西)

2

我不知道真的UR設置,但normaly你必須設置這些在/Configuration/TypoScript/setup.txt路徑像這樣

module.tx_yourext { 
    persistence { 
     storagePid = {$pid} 
    } 
    view { 
     templateRootPath = {$templateRootPath} 
     partialRootPath = {$partialRootPath} 
     layoutRootPath = {$layoutRootPath} 
    } 
} 

此配置直到您添加靜態模塊您的擴展板。你也應該將這些行添加到ext_tables.php

if (TYPO3_MODE === 'BE') { 
    Tx_Extbase_Utility_Extension::registerModule(
     $_EXTKEY, 
     'web',   // Main area 
     'mod1',   // Name of the module 
     '',    // Position of the module 
     array(   // Allowed controller action combinations 
      'Controller' => 'actionName' 
     ), 
     array(   // Additional configuration 
      'access' => 'user,group', 
      'icon'  => 'EXT:my_ext/ext_icon.gif', 
      'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xml', 
     ) 
    ); 
} 
+0

我已經添加了我的靜態模板到網站根模板。我已更新我的問題 –

+0

您是否檢查是否使用TS設置?您可以通過使用TS對象瀏覽器(在模板模塊中)來做到這一點 – fnagel

+0

是的。所有加載完美...:s –

6

的主要問題將是Typo腳本配置將不會加載到根路徑中沒有模板的存儲文件夾或頁面上。

釋: Typo腳本配置,你會爲你的擴展設置羯羊它是在ext_typoscript_setup,一個靜態模板或通過PHP它總是將某處需要一個系統記錄模板頁面的根。否則它將不會被渲染 - 並且extbase擴展的路徑設置將不會發生,因此默認佈局,模板和部分路徑都會被設置,這就是腳本將查找您的東西的位置。

默認爲:

/Private/Resources/Layout/ 
/Private/Resources/Partials/ 
/Private/Resources/Templates/@Controllername/@Actionname 

,如果你需要直接在你的控制器注入視圖的設置覆蓋這些你backendmodule可以解決這個問題。

<?php 
namespace VendorKey\ExtensionName\Controller; 

class SettingsController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController { 

/** 
* Initializes the controller before invoking an action method. 
* @return void 
*/ 
protected function initializeAction() { 
    $this->setBackendModuleTemplates(); 
} 

/** 
* Set Backend Module Templates 
* @return void 
*/ 
private function setBackendModuleTemplates(){ 
    $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); 
    $viewConfiguration = array(
     'view' => array(
      'templateRootPath' => 'EXT:extension_name/Resources/Private/Templates/Modules/', 
      'partialRootPath' => 'EXT:extension_name/Resources/Private/Partials/Modules/', 
      'layoutRootPath' => 'EXT:extension_name/Resources/Private/Layouts/Modules/', 
     ) 
    ); 
    $this->configurationManager->setConfiguration(array_merge($frameworkConfiguration, $viewConfiguration));   
} 

/** 
* action settings 
* @return void 
*/ 
public function settingsAction(){ 

} 

} 

我希望這有助於 格爾茨石磊

4

正如@本傑明 - kott解釋說,首先需要加載TYPO3的後端模塊配置。不幸的是,默認情況下,擴展的輸入腳本文件不會自動加載。化妝TYPO3的

一種方法意識到了這一點Typo腳本文件是擴展的根文件夾中創建兩個文件:

  1. ext_typoscript_constants.txt

    <INCLUDE_TYPOSCRIPT: source="FILE:EXT:myext/Configuration/TypoScript/constants.txt"> 
    
  2. ext_typoscript_setup.txt

    <INCLUDE_TYPOSCRIPT: source="FILE:EXT:myext/Configuration/TypoScript/setup.txt"> 
    

(有點明顯,但:你應該用你替換這個路徑)

添加此文件後,你應該重新安裝擴展看到的變化。您可以使用TypoScript對象瀏覽器來確定您的設置和常量是否正在加載。

2

雖然這個線程是很老我想你們表達我對TYPO3 7.6 LTS解決方案。

首先,你需要通過Template > Edit whole record > Includes包括您的Typo腳本文件。

並在您的TypoScript你需要使用templateRootPaths.0而不是templateRootPath

module.tx_extension { 
    view { 
     templateRootPaths.0 = EXT:extension/Resources/Private/Backend/Templates/ 
     partialRootPaths.0 = EXT:extension/Resources/Private/Backend/Partials/ 
     layoutRootPaths.0 = EXT:extension/Resources/Private/Backend/Layouts/ 
    } 
}