Subscribe to Acqal
Got Thoughts? Write Us!
Approved TYPO3 Agency
Acqal is an approved TYPO3 agency focusing on support, training and website migration.
This means that we...
- are available on TYPO3.org
- make substantial contributions to TYPO3 teams
- are registered as business members of the TYPO3 Association
- have completed more than four TYPO3 projects
- have proven our technical abilities with quality TYPO3 extensions
- use TYPO3 for our own website
Popular Blog Posts
Tech Tuesday Went Snowboarding at T3BOARD09
TYPO3 and Other Open Source WCM Systems Dissed Again
Automatic tt_news META descriptions via Acqal's extension aqnewsmeta
TYPO3, comments and Gravatar via Acqal's extension comments_gravatar
TYPO3 Extension cbstarter Version 1.3.2 Released
Sunday at T3BOARD09 in Laax, Switzerland
Not Good, Not Bad, Just Different
Increase TYPO3 Workspace Relation Limits
Getting Help With TYPO3
Looking into TYPO3 Webhosting?
Blog Topics
Virgil on Twitter

Recent Blog Posts
US Political Campaign Websites - The Basics
My Talk at T3CON10 Dallas - TYPO3 User jobs and Tasks
Dallas Barbeque Joint Reviews
T3CON10 Dallas
Acqal is Going Through Some Changes
Creating a MySQL Database for TYPO3 using CPanel
Acqal Promotes Biking and Families with World Vision
It's Official T3CON10-Dallas Web Site Launched! Join Us!
Create a simple "Contact Us" mail form in TYPO3
Configure TYPO3 for Localized Websites
Blog Archives
5 How-to's on Using TYPO3's tt_news
Today and next week, we'll cover the how to do of last week's 10 ways of tt_news.
SavvyMiss.com Topical news Articles
SavvyMiss.com, a community for women, has lots of very topical content and for each topic, it's best served within its own section. Additionally, as each topic has its own section, there's also branded landing pages for each topic which allows for very targeted advertising.
How-to Topical news Articles
The basic premise is to create not one, but multiple tt_news content elements each with only a specific category allowed.
To prevent having to set the order by field and sorting direction in every tt_news content element, you can add the following to your TypoScript setup.
plugin.tt_news.listOrderBy = datetime DESC
On look and feel, you can assign a specific template for each tt_news content element.
To limit the number of news items or even pick a specific page to send the reader to, you can modify Other Settings.
AINonline.com most recent news listing
AINonline.com provides the latest news and conference information for the aviation industry. For them, getting the latest news in a teaser format is fairly common. However, they also have a second version of more recent news from specific industry sectors.
How-to most recent news listing
This particular view is really a near default usage of a tt_news content element. The main issue is to determine whether the LIST or LATEST view is better suited to your needs. If you need to revise the template, you can select another like in above.
BJTonline.com news Articles in the menu
BJTonline.com is written for the users of business aircraft, as in those riding in the cabin. In the aim of getting the news where the readers are looking, the latest news articles are also linked from within the left navigation of the website.
How-to news Articles in the menu
Due to very specific, non-generalized client needs, this particular menu modification was handled by writing a non-public, custom extension which generates the entire left navigation.
In another project, we created the left navigation to be created by TYPO3 as normal, but in certain cases, to call a user function from within the TMENU object.
The following PHP script, fileadmin/class.user_CustomMenu.php, is for class user_CustomMenu. Do be warned that this is an older script and may not play nicely with list paging.
<?php
class user_CustomMenu extends tx_ttnews {
var $cObj; // Reference to the parent (calling) cObj set from TypoScript
var $cObjOrg; // Reference to the parent (calling) cObj set from TypoScript
// Default plugin variables:
var $prefixId = 'tx_ttnews'; // Same as class name
var $extKey = 'tt_news'; // The extension key.
var $debugmpf = 0;
function LoadTTNewsPlugin($pid) {
// get the tt_contents which lists TT_NEWS ( list_type=9 )
$result = @$GLOBALS['TYPO3_DB']->exec_SELECTquery( "*", "tt_content", 'pid='. intval($pid) . ' AND CType="list" AND list_type=9 ' . $this->cObj->enableFields("tt_content") );
while ( $result != null && $contentrow = @$GLOBALS['TYPO3_DB']->sql_fetch_assoc( $result ) ) {
unset($this->cObj->data );
$this->cObj->data = $contentrow ;
// convert flexform XML into array
$this->pi_initPIflexForm();
// check if it is a list or latest plugin
$code = $this->pi_getFFvalue($this->cObj->data ['pi_flexform'], 'what_to_display', 'sDEF');
if ( strpos($code, "LIST" ) === 0 || strpos($code, "LIST" ) > 0 ) {
$this->theCode = $code;
break;
} else {
$this->cObj->data = NULL;
}
}
}
/**
* Return value from somewhere inside a FlexForm structure
*
* @param array FlexForm data
* @param string Field name to extract. Can be given like "test/el/2/test/el/field_templateObject" where each part will dig a level deeper in the FlexForm data.
* @param string Sheet pointer, eg. "sDEF"
* @param string Language pointer, eg. "lDEF"
* @param string Value pointer, eg. "vDEF"
* @return string The content.
*/
function pi_setFFvalue(&$T3FlexForm_array,$fieldName,$newvalue, $sheet='sDEF',$lang='lDEF',$value='vDEF') {
$sheetArray = is_array($T3FlexForm_array) ? $T3FlexForm_array['data'][$sheet][$lang] : '';
if (is_array($sheetArray)) {
$T3FlexForm_array['data'][$sheet][$lang][$fieldName][$value] = $newvalue;
}
}
function GetMostPopularNewsArticlesMenuTop($I,$conf) {
$this->conf = $conf;
if ( $I["uid"] == $GLOBALS['TSFE']->page["pid"] ) {
$this->cObjOrg = $this->cObj;
$this->LoadTTNewsPlugin($GLOBALS['TSFE']->page["pid"] );
if ( $this->cObj->data != NULL ) {
$this->local_cObj = t3lib_div::makeInstance ('tslib_cObj'); // Local cObj.
$this->debugmpf = 1;
$this->pi_setFFvalue($this->cObj->data['pi_flexform'], 'listLimit', '8', 's_misc') ;
if ( $this->conf['templateFile'] != "" && $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'template_file', 's_template') != "" ) {
$this->pi_setFFvalue($this->cObj->data['pi_flexform'],
'template_file', NULL, 's_template');
}
$this->init($conf);
unset($this->piVars["page"] );
$content = $this->displayList();
$this->debugmpf = 0;
$link = '<li><i>'.$this->pi_linkToPage("More in ". $I ["title"], $I["uid"] ). '</i></li>';
$I["parts"]["after"] = '<ul><ul>'. $content.$link.'</ul></ul>';
}
}
return $I;
}
function GetMostPopularNewsArticlesMenu($I,$conf) {
$this->conf = $conf;
if ( $I["uid"] == $GLOBALS['TSFE']->page["pid"] ) {
$this->cObjOrg = $this->cObj;
$this->LoadTTNewsPlugin($GLOBALS['TSFE']->page["pid"] );
if ( $this->cObj->data != NULL ) {
$this->local_cObj = t3lib_div::makeInstance('tslib_cObj'); // Local cObj.
$this->debugmpf = 1;
$this->pi_setFFvalue($this->cObj->data['pi_flexform'], 'listLimit', '8', 's_misc') ;
if ( $this->conf['templateFile'] != "" && $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'template_file', 's_template') != "" ) {
$this->pi_setFFvalue($this->cObj->data['pi_flexform'],
'template_file', NULL, 's_template');
}
$this->init($conf);
unset($this->piVars["page"] );
$content = $this->displayList();
$this->debugmpf = 0;
$link = '<li><i>'.$this->pi_linkToPage("More in ". $I["title"], $I["uid"] ). '</i></li>';
$I["parts"]["after"] = '<ul>'. $content.$link.'</ul>';
}
}
return $I;
}
}
?>
The following TypoScript is what calls the above PHP script.
## Left Menu ( liv.leftMenu )
includeLibs.leftMenu = fileadmin/class.user_CustomMenu.php
lib.leftMenu = HMENU
lib.leftMenu {
wrap = <ul>|</ul>
excludeUidList = 314,315,316,317,318,319,320,321,322,323,324,325,352,353,354
1 = TMENU
1.expAll = 1
1.NO{
wrapItemAndSub = |*|<li>|<hr class="white" /></li>|*|<li>|</li>
stdWrap.case = upper
}
2 = TMENU
2.wrap = <ul>|</ul>
2.expAll = 1
2.IProcFunc= user_CustomMenu->GetMostPopularNewsArticlesMenu
2.IProcFunc.templateFile = fileadmin/templates/tt_news_leftmenu_template.htm
2.NO{
wrapItemAndSub = <li>|</li>
}
3 = TMENU
3.wrap = <ul>|</ul>
3.NO{
wrapItemAndSub = <li>|</li>
}
}
[PIDinRootline = 81]
lib.leftMenu.1.IProcFunc= user_CustomMenu-
>GetMostPopularNewsArticlesMenuTop
lib.leftMenu.1.IProcFunc.templateFile =
fileadmin/templates/tt_news_leftmenu_template.htm
[global]
BJTonline.com paged news
BJTonline.com is the online home to the slick print magazine, as such advertisers are provided for plenty of views as well by paging the news articles after every 300 words. For longer articles, this might mean 7-times more ad views than normal.
How-to paged news
For paging a news article, the directions provided by tt_news documentation on SINGLE view is on target. In essence, if you're using the default tt_news template, you only need to add and adjust the following TypoScript in the setup area to your site.
plugin.tt_news {
useMultiPageSingleView = 1
maxWordsInSingleView = 300
# insert pagebreaks only after paragraphs
useParagraphAsPagebreak = 1
# token used in news bodytext to trigger a pagebreak
pageBreakToken = <---newpage--->
# show subheader on all pages
subheaderOnAllSViewPages = 0
# append the pagebrowser to the bodytext without the special template marker ###NEWS_SINGLE_PAGEBROWSER###
appendSViewPBtoContent = 0
}
BPMinstitute.org White Papers login or visitor registration
BPMinstitute.org has been established in response to the demand for education and peer exchange on all aspects surrounding business process computing. As the website content provided is high-quality and at times sponsor-backed, there's a strong need to prevent illegitimate access. To overcome this there's membership access restrictions in place that's also supplemented with the ability for website visitors to gain temporary access to a single white paper.
How-to News Article login or User registration
When you have restricted access news content, you still want to provide a means to show teasers for, yet not give away your content. Most of the time, it's a case of a show all or nothing. With TYPO3's tt_news, through the use of multiple tt_news content elements that manipulate the Access and Template properties, you can create access level views.
As you can see below, creating these limited and full news view does take a little prepartory work in regards to tt_news content elements, login content element and a registration content element.
When dealing with the member registration aspects, a bit of custom coding was required for this originally TYPO3 3.6 website. These days those, you can use extension sr_feuser_register quite normally. The hard part is the need to enable auto-login after registration back to the current page.
Got Questions?
Please share them by commenting on this blog post.
Keywords:
- tt_news, typo3, news events, restrict news access, news in menu, paged news, news by topic


Add comment
* - required fieldthis depends on where you want to change the date.
tt_news has several views: LIST, LATEST and SINGLE being the most used ones.
here's how you change it for LIST view using typoscript code in the SETUP section:
this shows a date in the day.month.year format... eg: 12.02.2010 (12 feb 2010)
to format date/time in the other views you use the same date_stdWrap, but you just change the display...
LATEST:
SINGLE:
As you can see, the format (%d.%m etc) is passed to the php strftime, so if you want to show time or the date in another format, check out the format identifiers that php's strftime function can handle.
The identifiers can be found here...
http://www.php.net/manual/en/function.strftime.php
Hope this makes it clear.
Cheers,
radu
for the SINGLE view.
Got a little carried away.