[TYPO3] TS for specific [news, or other] content elements
Kathryn Blair
artscoop at mail.arts.ubc.ca
Fri Jun 27 02:11:11 CEST 2008
Hi everyone,
I want to be able to set separate TS for specific news content elements.
I've seen some potential info inline for this, but not ones which made it
clear to me how I could adapt them to what I wanted to do.
What I REALLY want to do is use a condition to target a specific news
elemenet based on its uid (in tt_content). I saw an example here:
[globalVar = TSFE:tt_content|uid = 37]
plugin.tt_news._LOCAL_LANG.de.preAuthor = Autor:
[global]
The reason this doesn't work (and should be taken off that site -- if I can
figure out an alternate method I'll replace it) is because [globalString =
TSFE:fe_user|user|username = test] is not basing it's true/falseness on the
table fe_user, but the variables in the TSFE. I don't know a lot of PHP, but
I went on an odyssey trying to figure this out and this is what I've got:
There is no tt_content variable for TSFE, but there is a cObj variable.
(which I saw here:
http://www.typo3-unleashed.net/typo3apidocs/typo3api_4.0.0/html/d8/d11/class
_8tslib__fe_8php-source.html). cObj also has variables [sorry if my
terminology is off], including $currentRecord, which "is set to the
[table]:[uid] of the record delivered in the $data-array, if the cObjects
CONTENT or RECORD is in operation. Note that $GLOBALS['TSFE']->currentRecord
is set to an equal value but always indicating the latest record rendered."
(http://www.typo3-unleashed.net/typo3apidocs/typo3api_4.0.0/html/da/d2c/clas
stslib__cObj-members.html). Yay, you would think this would solve all of my
problems!
Well, this ts does render the table:uid (in this case, because I just put
the typoscript in a template, that was pages:uid-of-current-page):
20 = TEXT
20.data = TSFE:cObj|currentRecord
20.wrap = TSFE=|<br />
but I can't seem to write a condition based on this that is successful in
targeting the specific content object. Here's what I'm trying:
[globalString=TSFE:cObj|currentRecord=tt_content:1316]
plugin.tt_news.templateFile=fileadmin/Arts_Co-op/templates/news_templates/ar
ts-co-op-headlines.tmpl
[global]
I know that
plugin.tt_news.templateFile=fileadmin/Arts_Co-op/templates/news_templates/ar
ts-co-op-headlines.tmpl is correct because I tried it with other conditions
(TSFE:id=321). I know I can set template files on the tt_news content
element page itself, but the tt_news manual says that it's better to do so
via ts, and I was hoping that doing it via TS I wouldn't have to erase and
reset the template every time I update the file. Also, I might need to set
some other ts this way, and it seems like a logical thing to want to do,
from my perspective.
I'm sure either I just don't fully grasp how currentRecord is supposed to
work (which would make me sad, unless someone knows a different way to do
this), or I'm just doing something incorrectly. If there's some massively
easier way to do this, please let me know -- although like I said I didn't
think (or understand how) the other solutions I'd seen would work for me.
Here's the ts I'm using to grab the tt_news element and stick it in my
template:
dates.10=CONTENT
dates.10.table = tt_content
dates.10.select.pidInList=879
dates.10.select.uidInList=1316
dates.10.select.wrap = <div class="important-dates-employers"> | </div>
Thanks for any help in advance,
Kath
More information about the TYPO3-english
mailing list