无法使Typo3 Fluid页面模板化工作

时间:2013-09-19 19:16:38

标签: php fluid typo3-6.1.x fedext

我正在尝试使用Typo3 Fluid模板引擎,我设法让它运行一些肮脏的方式。但后来我发现了fedext.net projectthis demo。并尝试关注this tutorial。我以以下目录结构结束:

typo3conf/
  ext/
    my_extension/
      Classes/
        Controller/
          PageController.php
      Configuration/
        constants.txt <empty for now>
        setup.txt
      Resources/
        Private/
          Layouts/
          Partials/
          Templates/
            Page/
              FrontPage.html
        Public/
      ext_autoload.php <empty>
      ext_emload.php
      ext_localconf.php <empty>
      ext_tables.php

PageController.php:

<?php
class Tx_MyExtension_Controller_PageController extends Tx_Fluidpages_Controller_AbstractPageController {

    public function frontPageAction() {
    }
}

SETUP.TXT:

plugin.tx_myextension.view {
    templateRootPath = EXT:my_extension/Resources/Private/Templates/
    partialRootPath = EXT:my_extension/Resources/Private/Partials/
    layoutRootPath = EXT:my_extension/Resources/Private/Layouts/
}

FrontPage.html:

{namespace v=Tx_Vhs_ViewHelpers}
{namespace flux=Tx_Flux_ViewHelpers}
<f:layout name="Page" />
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
     xmlns:v="http://fedext.net/ns/vhs/ViewHelpers"
     xmlns:flux="http://fedext.net/ns/flux/ViewHelpers"
     xmlns:f="http://fedext.net/ns/fluid/ViewHelpers">

    <f:section name="Configuration">
        <flux:flexform id="default-page" label="Default page template">
            <flux:flexform.field.input name="settings.entryLevel"
                                       label="Main menu entry level override for this page only"
                                       eval="int,trim" minimum="0" maximum="6"
                                       default="{v:var.typoscript(path: 'lib.menu.main.entryLevel')}">
                <flux:flexform.field.wizard.slider hideParent="TRUE" step="1" width="100" />
            </flux:flexform.field.input>
        </flux:flexform>
        <flux:flexform.grid>
            <flux:flexform.grid.row>
                <flux:flexform.grid.column colPos="1" name="Hero Unit" />
            </flux:flexform.grid.row>
            <flux:flexform.grid.row>
                <flux:flexform.grid.column colPos="0" name="Main Content" />
            </flux:flexform.grid.row>
            <flux:flexform.grid.row>
                <flux:flexform.grid.column colPos="2" name="Footer Content" />
            </flux:flexform.grid.row>
        </flux:flexform.grid>
    </f:section>

    <f:section name="Content">
        <v:page.content.render column="0" />
    </f:section>

    <f:section name="AnotherSection">
        <!-- more sections as desired, rendering triggered from the "Page.html" Layout file -->
    </f:section>

</div>

ext_emconf.php

<?php

$EM_CONF[$_EXTKEY] = array (
    'title' => 'Homepage',
    'description' => 'Homepage',
    'category' => 'misc',
    'shy' => 0,
    'version' => '1.0.0',
    'dependencies' => '',
    'conflicts' => '',
    'priority' => '',
    'loadOrder' => '',
    'module' => '',
    'state' => 'stable',
    'uploadfolder' => 0,
    'createDirs' => '',
    'modify_tables' => '',
    'clearcacheonload' => 0,
    'lockType' => '',
    'author' => 'me',
    'author_email' => 'mail@me.com',
    'author_company' => 'me',
    'CGLcompliance' => NULL,
    'CGLcompliance_note' => NULL,
    'constraints' => 
    array (
        'depends' => 
        array (
            'typo3' => '6.1.0',
            'cms' => '',
            'flux' => '5.0.0',
        ),
        'conflicts' => 
        array (
            'templavoila' => '',
        ),
        'suggests' => 
        array (
        ),
    ),
);

?>

ext_tables.php

<?php
if (!defined ('TYPO3_MODE')) {
    die ('Access denied.');
}

t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'My Extension Homepage');
Tx_Flux_Core::registerProviderExtensionKey('my_extension', 'Page');

所以问题是: 虽然后端似乎有用,但我在前端经常遇到PHP致命错误:

  

核心:错误处理程序(FE):PHP警告:在C:\ xampp \ apache \ htdocs \ typo-fluid \ typo3temp \ Cache \ Code \ cache_core \ ClassLoader_AbstractConfigurationProvider_bc71b4377996b2e6d72f.php第481行中为foreach()提供的参数无效

调试时我发现提供的值为null。看起来我错过了一些简单的东西。但上面的文件结构只是this thing

的略微修改版本

是否有任何好的分步教程如何使用 fedext 工具创建几个模板和内容元素?因为我安装了介绍包并尝试在后端和文件结构中复制设置,但看起来还不够,我在这里缺少一些非常基本的东西。

更新:  我还看到了thisthis,希望得到Claus Due的答案,因为他是 fedext 工具的作者。

1 个答案:

答案 0 :(得分:2)

所以,看起来这里的主要问题不是原始问题中提到的警告,而是 Apache 日志中的错误:

PHP Fatal error: Cannot redeclare class Tx_Vhs_Service_AssetService in...

是由带有 vhs 扩展名的PHP 5.3.3 incompatibility引起的。 所以,我已经更新了PHP安装并在我的扩展配置中修复了几个拼写错误,之后它开始按预期工作。