[TYPO3] Another TypoScript problem/question

Dmitry Dulepov [typo3] dmitry at typo3.org
Tue Apr 22 09:31:33 CEST 2008


Stephen Bungert wrote:
> temp.nsnCurrPtitle = TEXT
> temp.nsnCurrPtitle.data = DB : pages : 55 : title
> 
> Then this returns the page 55's Title.
> 
> Works great! As long as I enter a number like 55 or 56.
> 
> I then tried to get the current Pid with this
> 
> temp.nsnCurrPid = TEXT
> temp.nsnCurrPid.data = global:HTTP_GET_VARS|id

This is bad because it does not work with shortcuts, realurl and cooluri, also may fail with mount points. You should use TSFE:id like this:

temp.nsnCurrPid = TEXT
temp.nsnCurrPid.data = TSFE:id

> This works, and shows me the current Page ID.
> 
> So why can't I use temp.nsnCurrPid in temp.nsnCurrPtitle.data?
> 
> temp.nsnCurrPtitle.data = DB : pages : temp.nsnCurrPid : title

Read docs! TSRef in particular. "data" does not support such thing. It will try use "temp.nsnCurrPid" as uid and obviously fail. "temp.nsnCurrPid" is not a variable in normal sense. You should have used this:

temp.nsnCurrPtitle = TEXT
temp.nsnCurrPtitle.field = page:title

Your approach with "DB" also will show hidden pages, which is not what you want to do.

-- 
Dmitry Dulepov
TYPO3 core team
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
"Nothing is impossible. There are only limits to our knowledge"


More information about the TYPO3-english mailing list