1

我正在尝试开始使用 Typo3 Fluid 模板引擎,但我设法让它以一种肮脏的方式运行。但后来我发现了fedext.net 项目这个演示。并尝试按照本教程进行操作。我以以下目录结构结束:

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

页面控制器.php:

<?php
class Tx_MyExtension_Controller_PageController extends Tx_Fluidpages_Controller_AbstractPageController {

    public function frontPageAction() {
    }
}

设置.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() 提供的参数无效

在调试时我发现提供的值为空。看起来我错过了一些简单的东西。但是上面的文件结构只是这个东西的稍微修改的版本

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

更新:我也看过thisthis,并希望从Claus Due那里得到答案,因为他是fedext工具的作者。

4

1 回答 1

2

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

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

这是由于PHP 5.3.3vhs扩展不兼容造成的。因此,我更新了 PHP 安装并修复了我的扩展配置中的几个拼写错误,之后它开始按预期工作。

于 2013-09-23T10:13:39.683 回答