Modify body tag in TYPO3 by replacing with select query results
So that's been a major breakthrough for me tonight. I still have a ways to go to get my extension working in top form, but it's going to be pretty killer.
## Find out the Pid that the news item is located in
viewSelect.newsPid = RECORDS
viewSelect.newsPid {
dontCheckPid = 1
tables = tt_news
source.data = GPvar:tx_ttnews|tt_news
conf.tt_news = TEXT
conf.tt_news.field = pid
#conf.tt_news.required = 1
}
## Build the UID of the folder containing the news item into the id
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject < viewSelect.newsPid
page.bodyTagCObject.wrap = <body id="newslayout-|">
What I've decided to do instead, as a way of denoting what news items require certain layout considerations, is to place news items in system folders based on if I need the news item to appear in a wide layout, a narrow layout, a layout with a particular color scheme, etc.
I'm almost close to finishing a system that will allow me to do this. Basically, I can display a variation of a templavoila template for any news item based on the folder which the news is stored in.
One thing I've come across was a way to dynamically change the body tag's id attribute of my pages based on the tt_news uid. More specifically, the example below creates a body id attribute based on the folder that a news record is stored in. I use this method of setting the body tag in my new tt_news display system. It looks like this
Ok, you don't know what I'm talking about. Allow me to explain.
Basically, I want to publish a bunch of different types of news items.
- News with video
- News with code snippets
- long essays
- Really short news items
So I'll have many types of news items, some of which may require different layouts. For example, If I am going to publish some typoscript code in a news item, I want to make sure that the div it's placed in is wide enough to hold a long string.
At the same time, I may like to have a narrow column news container when I feel it would be suitable.
Now the thing is, I know that I could just place the different types of news items in different news categories, but I don't want to use categories for the purpose of specifying what type of layout to use.