Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将php脚本中的内容包含到打字脚本中_Php_Typo3_Typoscript - Fatal编程技术网

将php脚本中的内容包含到打字脚本中

将php脚本中的内容包含到打字脚本中,php,typo3,typoscript,Php,Typo3,Typoscript,我想使用lib对象将php脚本的输出包含到typoscript中。。。 我惨败了: 我这样声明lib对象: TS: 然后我需要使用一个变量将其包含在TS的其余部分中: {f:cObject(typoscriptObjectPath:lib.banner)} 这很可能是它失败的地方。我没有使用流体,但我猜f:cObject指的是流体模板 下面是我正在使用的非常简单的php脚本: class user_banner{ public $cObj; /** * Scans

我想使用lib对象将php脚本的输出包含到typoscript中。。。 我惨败了:

我这样声明lib对象:

TS:

然后我需要使用一个变量将其包含在TS的其余部分中:

{f:cObject(typoscriptObjectPath:lib.banner)}
这很可能是它失败的地方。我没有使用流体,但我猜f:cObject指的是流体模板

下面是我正在使用的非常简单的php脚本:

class user_banner{

    public $cObj;

    /**
     * Scans the files in the images folder
     * for images and returns it, if present
     */

    public function user_showBanner($content, $conf){

        $images = scandir('images');
        return implode(',', $images);

    }
}
我做错了什么??? 我使用的是typo34.6.x

[编辑]

这个页面是由一些T3裂纹制作的,整个内容被包装成一些lib对象,然后用某种lib呈现。下面是它的部分外观:

lib{

        markupBodyColumns {
        1 >
        2 {
            value (
            <div id="col2" class="col">

            //here I try to insert my banner 
            <span class="bannerClass">{$lib.banner}</span>

                <div class="pageTitle">
                    {renderLib:markupBodyPageTitle}
                </div>
                <div class="contentWraper">
                    <div class="content">
                        {renderLib:markupBody}
                    </div>
                    {renderLib:markupFooter}
                </div>
            </div>
            )
        }

}
再次-不是输出


我到底做错了什么?

如果你的网站中没有使用流体,这将不会产生任何输出,因为

{f:cObject(typoscriptObjectPath:'lib.banner')}
流体ViewHelper的内联表示法,只能在流体模板中使用

使用打字脚本和userFunc,可以在lib.banner中获得showBanner的返回值。你只需要在网站上的某个地方显示它

如果您的网站中有页面对象,您可以按如下方式将其添加到页面:

page.20141031 < lib.banner

其中20141031是一个唯一的数字,尚未用于页面对象的另一部分。

我未使用流体是什么意思?不能在流体样板外部使用流体视图辅助对象。如果您处于FLUIDTEMPLATE上下文中,请尝试将lib.banner用单引号括起来。顺便说一句,您可以使用纯打字脚本解决方案来实现这一点。那么,{…}部分是流体视图助手吗?请容忍我-我是T3新手,完全困惑:PHP脚本只是一个测试片段,如果我能从中获得一些值,它最终会更大。所以“纯TS”很可能不是我的目标。同样:我只需要将PHP脚本的输出打包到TS变量中。那不会那么难吧?谷歌没有提供任何有用的结果,因此我的问题是;谢谢-这澄清了一些事情:问题是,任何地方都没有页面对象。这个页面是由一些T3破解者制作的,他们只使用TS来设置整个页面。整个内容被包装到一个lib对象中,并使用一些自制的renderlib进行渲染。这就是为什么我想到用常量/变量输出PHP函数的内容。所以你的方法没有真正起作用,因为我没有办法将它插入到模板中,因为没有模板。。。我将在上面的编辑中添加ts…您不能使用userfunction来设置常量的值。常数是静态的。
page = PAGE
page.200000 = USER_INT
page.200000.userFunc = user_banner->user_showBanner
{f:cObject(typoscriptObjectPath:'lib.banner')}
page.20141031 < lib.banner