Running a SQL Query using TypoScript

Well, after using this feature for quite long time, I though I should post this info:Consider the following Query:

SELECT DISTINCT FROM_UNIXTIME(`datetime`, ‘%Y’) AS `year` FROM tt_news where pid=113 order by datetime limit 1

My main goal was to get the latest year from the tt_news records, that is then going to be pushed to Tesseract filter.

Soln:

20 = CONTENT
20 {
table = tt_news
select {
selectFields = FROM_UNIXTIME(`datetime`, ‘%Y’) AS year
orderBy = datetime desc
pidInList = 113
max = 1
}
renderObj = TEXT
renderObj.field = year
}

Reference: http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.5.0/view/1/5/#id2621093

Display News Title as Page Title in tt_news detail view

To Display the news title in the detail view of tt_news instead of page title use the following code

[globalVar = TSFE:id = {$newsSinglePid}]
temp.newsTitle = RECORDS
temp.newsTitle {
source = {GPvar:tx_ttnews|tt_news}
source.insertData = 1
tables = tt_news
conf.tt_news >
conf.tt_news = TEXT
conf.tt_news.field=title
wrap = <title>|</title>
}
page.config.noPageTitle = 2
(Your Object) >
(Your Object) < temp.newsTitle
[global]

Technorati : , ,

Html tags like table,p are not comming for the newly added RTE field in tt_news

While I was working on some project, there was a requirement to add extra RTE field for tt_news. I extended the table tt_news by adding RTE fields. I faced the following problem

1) I inserted the table but after saving the tt_news record the table started disappearing

2) <p> tag was not inserted automatically for press of Enter

After doing some research I found the solution

1) Set the transformation mode for the RTE to “ts_css” in ext_tables.php

ex-

if (t3lib_extMgm::isLoaded(‘css_styled_content’)) {
t3lib_extMgm::addPageTSConfig(‘
# RTE mode for table “tt_news”
RTE.config.tt_news.exampleField.proc.overruleMode=ts_css’);
}

Here the table used is tt_news and the filed name is exampleField

2) For P tag to be inserted for every new line character I added the code

$rowfrntbl[$tblcol]=$pObj->local_cObj->stdWrap($rowfrntbl[$tblcol], $pObj->conf[‘general_stdWrap.’])

Here I am using hook  for tt_news to get the desired result.