简体   繁体   中英

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?

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:

$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($GLOBALS['TYPO3_DB']->sql_query("SELECT media FROM pages WHERE uid = ".$GLOBALS['TSFE']->id));
$mediaFiles = $row['media'];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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