首页 文章

TYPO3 4.6包含带有typoscript的extbase插件

提问于
浏览
1

我有TYPO3 4.6,在tempvoila模板中我有typoscript对象路径 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

但没有显示任何内容,如果有错误或者TYPO3 4.6中包含的extbase 1.4中的内容发生了变化,有人可以提出建议吗?

2 回答

  • 1

    我认为问题在于你的行动 . 你真的在Controller中有一个randomPhotoSlideShowAction吗?还要检查指定的pluginName是否正确 .

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

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

    如果您的行为是正确的,请确保您实际上从您的行动中返回了一些内容!

    public function randomPhotoSlideShowAction(...) { 
    
        // [...]
    
        $this->view->assign('foo', 'bar');
    
        return $this->view->render();
    }
    
  • 0

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

    controller = PhotoController
    

相关问题