简体   繁体   English

TYPO3渲染内容对象元素

[英]TYPO3 render content object element

I'm writing an extBase extension but came to a problem with rendering records. 我正在编写extBase扩展,但是在呈现记录时遇到了问题。 Maybe I'm missing something, but if I did I guess I should be getting errors. 也许我缺少了一些东西,但是如果我错过了,那我应该会出错。

The code is part of the extension repository: 该代码是扩展存储库的一部分:

$conf = array(
    'tables' => 'tt_content',
    'source' => 21449, //actually here is variable for content uid but in given example i have this id
    'dontCheckPid' => 1
);

$cObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
$cObject->cObjGetSingle('RECORDS', $conf);

var_dump returns an empty string, but I also tried this: var_dump返回一个空字符串,但是我也尝试过这样:

$cObject->RECORDS($conf);

and

$GLOBALS['TSFE']->cObj->RECORDS($conf);

resulting in an empty string, too. 也导致一个空字符串。

When I check the database I find a record with that id, it's not hidden or deleted. 当我检查数据库时,我发现具有该ID的记录,该记录没有被隐藏或删除。 The cType is textpic . cType是textpic

I suppose I could render it manually but that will be harder since I would have to write code for each cType we have in use. 我想我可以手动渲染它,但是那样会比较困难,因为我必须为使用中的每个cType编写代码。

Can anybody help here? 有人可以帮忙吗?

Maybe you should check extension called "vhs"? 也许您应该检查名为“ vhs”的扩展名? With it you will be able to render content elements with Fluid 有了它,您将能够使用Fluid渲染内容元素

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM