[英]TYPO3: get media content for special language
I want to get the picture of a certain page (the user set it on the tab "Resources"). 我想获得某个页面的图片(用户在“资源”选项卡上设置它)。 For my default language I can use the media field of 对于我的默认语言,我可以使用媒体字段
$rootline =$GLOBALS['TSFE']->rootLine ;
But for my secondary language the media field is empty. 但对于我的第二语言,媒体领域是空的。 The reason is the page translation I added which has its own settings. 原因是我添加的页面翻译有自己的设置。 But now I need the media field for my default language. 但现在我需要媒体字段作为我的默认语言。
How do I get the contents of rootline for a special language? 如何获取特殊语言的rootline内容?
You could use 你可以用
$GLOBALS['TSFE']->all['rootLine'][1]['media']
But then you need to know the level of the page within the page tree, so this is not a very practical solution. 但是,您需要知道页面树中页面的级别,因此这不是一个非常实用的解决方案。
The easiest way I see is a simple SQL query: 我看到的最简单的方法是一个简单的SQL查询:
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($GLOBALS['TYPO3_DB']->sql_query("SELECT media FROM pages WHERE uid = ".$GLOBALS['TSFE']->id));
$mediaFiles = $row['media'];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.