TYPO3 4.6 包括带有 Typoscript 的 extbase 插件

发布于 2024-12-25 10:17:56 字数 1328 浏览 2 评论 0原文

我有 TYPO3 4.6,在 tempvoila 模板中我有打字稿对象路径 lib.header 并且我想要 将插件的输出重定向到 lib.header 我在 ext_localconf.php 中编写和配置了扩展库和插件,如下所示:

Tx_Extbase_Utility_Extension::configurePlugin(
   $_EXTKEY,
   'RandomPhotoSlideShow',
   array(
       'Photo' => 'randomPhotoSlideShow',
   ),
   // non-cacheable actions
    array(

        'Photo' => ''

    )
);

在 ext_tables.php 中如下所示:

Tx_Extbase_Utility_Extension::registerPlugin(
    $_EXTKEY,
    'RandomPhotoSlideShow',
    'Gets random photos for slide show'
);

在 Typoscript 模板中我有这样的:

plugin.tx_gallery.widgets {
    papaWidget = USER
    papaWidget {
        userFunc = tx_extbase_core_bootstrap->run
       pluginName = RandomPhotoSlideShow
        extensionName = Gallery
        controller = Photo
        action = randomPhotoSlideShow
        switchableControllerActions {
                Photo {
                        1 = randomPhotoSlideShow
                }
        }

        settings =< plugin.tx_gallery.settings
        persistence =< plugin.tx_gallery.persistence
        view =< plugin.tx_gallery.view
        }
}

lib.header < plugin.tx_gallery.widgets.papaWidget

但没有显示任何内容,有人可以建议我在哪里出错或者 extbase 中是否发生了更改1.4 包含在 TYPO3 4.6 中吗?

I have TYPO3 4.6, in tempvoila template i have typoscript object path lib.header and I want
to redirect output of plugin to lib.header
I have extension Gallery and plugin written and configured in ext_localconf.php like this:

Tx_Extbase_Utility_Extension::configurePlugin(
   $_EXTKEY,
   'RandomPhotoSlideShow',
   array(
       'Photo' => 'randomPhotoSlideShow',
   ),
   // non-cacheable actions
    array(

        'Photo' => ''

    )
);

in ext_tables.php like this:

Tx_Extbase_Utility_Extension::registerPlugin(
    $_EXTKEY,
    'RandomPhotoSlideShow',
    'Gets random photos for slide show'
);

and in typoscript template I have this:

plugin.tx_gallery.widgets {
    papaWidget = USER
    papaWidget {
        userFunc = tx_extbase_core_bootstrap->run
       pluginName = RandomPhotoSlideShow
        extensionName = Gallery
        controller = Photo
        action = randomPhotoSlideShow
        switchableControllerActions {
                Photo {
                        1 = randomPhotoSlideShow
                }
        }

        settings =< plugin.tx_gallery.settings
        persistence =< plugin.tx_gallery.persistence
        view =< plugin.tx_gallery.view
        }
}

lib.header < plugin.tx_gallery.widgets.papaWidget

But nothing is displayed, could someone please advice where I have mistake or if something changed in extbase 1.4 included in TYPO3 4.6?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吃兔兔 2025-01-01 10:17:56

我认为问题出在你的行动上。你的控制器中真的有 randomPhotoSlideShowAction 吗?
还要检查指定的pluginName是否正确。

请尝试指定您的索引或列表操作,看看会发生什么。

action = index
switchableControllerActions {
    Photo {
        1 = index
    }
}

如果您的操作是正确的,请确保您确实从操作中返回了一些东西!

public function randomPhotoSlideShowAction(...) { 

    // [...]

    $this->view->assign('foo', 'bar');

    return $this->view->render();
}

I think the problem is your action. Do you really have a randomPhotoSlideShowAction in your Controller?
Also check if the specified pluginName is correct.

Please try to specify your index or list Action and see what happens.

action = index
switchableControllerActions {
    Photo {
        1 = index
    }
}

If your action is correct, make sure you are actually returning something from your action!

public function randomPhotoSlideShowAction(...) { 

    // [...]

    $this->view->assign('foo', 'bar');

    return $this->view->render();
}
薄荷港 2025-01-01 10:17:56

您的代码看起来不错,唯一缺少的是 Controller 部分(根据命名约定)

controller = PhotoController

Your code looks good, the only thing missing is the Controller part (as per naming convention) in

controller = PhotoController
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文