Subscribe to Acqal

Got Thoughts? Write Us!

Contact
Request
Validate

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

Acqal is a TYPO3 Association Business Member

Popular Blog Posts

Blog Topics

Virgil on Twitter

Please wait while virgilhuston tweets load Twitter is loading

Recent Blog Posts

Blog Archives

3 More How-to's on Using TYPO3's tt_news

Monday, June 1, 2009 12:26 PM EDT

By: Michael Cannon

voting in progress Submitting your vote...
Rating: 4.8 of 5. 4 vote(s).
Click the rating bar to rate this item.

About a month ago, I presented 10 different ways of using tt_news for various clients. That was then followed up by couple of posts covering the how-to of the first 5 and 2 more different ways of tt_news usage.

Cephalon.com news product and Archive Menu

Cephalon.com is one of the world’s top ten biopharmaceutical companies with over 30 products worldwide for innovative treatments of central nervous system disorders, pain and cancer. Instead of trying to create a specific page for the top products, they let the product's menu listing be auto-generated. On a similar note, the annual archive is auto-generated as well. 

Cephalon.com news product and archive menu

How-to for news product and Archive Menu

This implementation of tt_news categories or archives into the navigation structure by customedialabs is really one of the neatest combination of TypoScript and news content elements that I've ever come across.

In essence, the menu is created via multiple HMENU and TMENU objects as normal. However, the news year and category aspects are incorporated into the menu via RECORDS objects surrounded by TEXT objects to properly open and close the ordered tags.

By creating each part of the menu as an independent object and then joining it together in a COA object, maintenance is made simple. The TypoScript follows.

#Remove Anchor Tags
tt_content.stdWrap.dataWrap >

lib.first_sub_nav = HMENU
lib.first_sub_nav.special = list
lib.first_sub_nav.special.value = 13
lib.first_sub_nav {
1 = TMENU
1 {
noBlur = 1
expAll=0
wrap = |
NO.allWrap = <li>|</li>
NO.stdWrap.field = title
NO.doNotLinkIt = 1
NO.stdWrap.htmlSpecialChars = 1
ACT < .NO
ACT = 1
ACT.allWrap = <li class="section">|</li>

IFSUB < .NO
IFSUB = 1
IFSUB.allWrap = <li class="section">|</li>

ACTIFSUB < .NO
ACTIFSUB = 1
ACTIFSUB.allWrap = <li class="section">|</li>

CURIFSUB < .IFSUB
CURIFSUB = 1
CURIFSUB.allWrap = <li class="section">|</li>
}
}

lib.second_sub_nav1 = HMENU
lib.second_sub_nav1.special = list
lib.second_sub_nav1.special.value = 81
lib.second_sub_nav1.entryLevel = 1
lib.second_sub_nav1{
1 = TMENU
1 {
noBlur = 1
expAll=0
wrap = |
NO.allWrap = <li>|
NO.stdWrap.field = title
NO.stdWrap.htmlSpecialChars = 1

ACT < .NO
ACT = 1
ACT.allWrap = <li class="open">|
}
2 =
}

lib.second_sub_nav2 = HMENU
lib.second_sub_nav2.special = list
lib.second_sub_nav2.special.value = 267
lib.second_sub_nav2.entryLevel = 1
lib.second_sub_nav2{
1 = TMENU
1 {
noBlur = 1
expAll=0
wrap = |
NO.allWrap = <ul><li class="close">|</li>
NO.stdWrap.field = title
NO.stdWrap.htmlSpecialChars = 1

ACT < .NO
ACT = 1
ACT.allWrap = <li class="open">|
}
}

lib.second_sub_nav3 = HMENU
lib.second_sub_nav3.special = list
lib.second_sub_nav3.special.value = 269
lib.second_sub_nav3.entryLevel = 1
lib.second_sub_nav3{
1 = TMENU
1 {
noBlur = 1
expAll=0
wrap = |
NO.allWrap = <li>|
NO.stdWrap.field = title
NO.stdWrap.htmlSpecialChars = 1

ACT < .NO
ACT = 1
ACT.allWrap = <li class="open">|
}
}

lib.second_sub_nav4 = RECORDS
lib.second_sub_nav4.dontCheckPid = 1
lib.second_sub_nav4.tables = tt_content
lib.second_sub_nav4.source = 481

lib.second_sub_nav5 = TEXT
lib.second_sub_nav5.value = </ul></li>

lib.second_sub_nav6 = HMENU
lib.second_sub_nav6.special = list
lib.second_sub_nav6.special.value = 80,103,79
lib.second_sub_nav6.entryLevel = 1
lib.second_sub_nav6{
1 = TMENU
1 {
noBlur = 1
expAll=0
wrap = | </ul>
NO.allWrap = <li>|</li>
NO.stdWrap.field = title
NO.stdWrap.htmlSpecialChars = 1

ACT < .NO
ACT = 1
ACT.allWrap = <li class="selected">|</li>

IFSUB < .NO
IFSUB = 1
IFSUB.allWrap = <li class="close">|</li>

ACTIFSUB < .NO
ACTIFSUB = 1
ACTIFSUB.allWrap = <li class="open">|

CURIFSUB < .IFSUB
CURIFSUB = 1
CURIFSUB.allWrap = <li class="open">|
}
}

lib.sub_nav = COBJ_ARRAY
lib.sub_nav {
30 < lib.first_sub_nav
40 < lib.second_sub_nav1
50 < lib.second_sub_nav2
60 < lib.second_sub_nav3
70 < lib.second_sub_nav4
80 < lib.second_sub_nav5
90 < lib.second_sub_nav6
}

plugin.tt_news {
displayCatMenu {
catmenu_stdWrap.wrap = <ul>|</ul>
catmenuHeader_stdWrap.wrap =
catmenuItem_ACT_stdWrap.wrap = <li class="selected">|</li>
}
displayFirstCategory = 1
}

In above, lib.second_sub_nav4 is where the News Releases Products Menu content element is included into the menu structure as the category menu. As you can see below, it's a very simple news content element of the CATMENU view.

Topconpositioning.com products are news too

Topcon Positioning Systems provides the innovative positioning technology principally for the construction industries. When a year-old, high-end, high-cost proprietary product and content management system failed to do as promised for Topcon Positioning Systems TPS, they turned to TYPO3. Now TPS is managing and presenting latest news, press releases and even products with auto-generating menus and easy to navigate pages.

Topconpositioning.com products are news too

How-to on products are news too

While I'd like to say that this news as products customization is a major deal, the reality is that it's not.

Adding new fields to tt_news records is as easy as using the TYPO3 Extension Manager and Kickstarter to create the needed fields. Afterwards, you can modify the resulting ext_tables.php file to group new fields into tabs.

By grouping the new fields into tabs, you can better control the layout of the tt_news record and prevent over whelming editors. The following code comes from ext_tables.php to demonstrate grouping added tt_news fields into tabs. Take a look at the following screenshots to see them in action.

t3lib_div::loadTCA("tt_news");
t3lib_extMgm::addTCAcolumns("tt_news",$tempColumns,1);

t3lib_extMgm::addToAllTCAtypes("tt_news","--div--;Product
info,tx_tttopconproducts_product_image,tx_tttopconproducts_product_image_alt;;;;1-1-1,tx_tttopconproducts_product_fullimage,tx_tttopconproducts_product_fullimage_alt,tx_tttopconproducts_related_file,tx_tttopconproducts_filedescriptions,tx_tttopconproducts_manual_file,tx_tttopconproducts_manualdescriptions,tx_tttopconproducts_marketing_file,tx_tttopconproducts_marketingdescriptions,tx_tttopconproducts_specifications,tx_tttopconproducts_news_order,tx_tttopconproducts_ordervideo_link");
t3lib_extMgm::addToAllTCAtypes("tt_news","--div--;Descriptions,tx_tttopconproducts_shortdescription,tx_tttopconproducts_fulldescription;;;richtext[paste|bold|italic|underline|formatblock|class|left|center|right|orderedlist|unorderedlist|outdent|indent|link|image]:rte_transform[mode=ts];1-1-1;");
t3lib_extMgm::addToAllTCAtypes("tt_news","--div--;Techs,tx_tttopconproducts_technologies_box;;;richtext[paste|bold|italic|underline|formatblock|class|left|center|right|orderedlist|unorderedlist|outdent|indent|link|image]:rte_transform[mode=ts];1-1-1");
t3lib_extMgm::addToAllTCAtypes("tt_news","--div--;Product kits,tx_tttopconproducts_productkits_box;;;richtext[paste|bold|italic|underline|formatblock|class|left|center|right|orderedlist|unorderedlist|outdent|indent|link|image]:rte_transform[mode=ts];1-1-1");
t3lib_extMgm::addToAllTCAtypes("tt_news","--div--;News system,tx_tttopconproducts_news_url,tx_tttopconproducts_related_fielarchive_item;;;;1-1-1");
t3lib_extMgm::addToAllTCAtypes("tt_news","--div--;Right Urls Area,right_part_news,right_part_categories,right_part_pages;;;;1-1-1")

In case you're wondering, $tempColumns, is configuration array of the new tt_news fields.

Acqal.com Most Popular Blog Posts

Minor bout of self-promotion.

Acqal.com is an official TYPO3 agency in the United States. To let our blog readers know what other have found most interesting, we offer a popular blog posts listing.

Acqal.com most popular blog posts

How-to for Most Popular Blog Posts

This tt_news view is majorly handled by the TYPO3 extension newsreadedcount. As a bonus, you can check in the tt_news records themselves for the single-view read counts if you don't show the counts in the popular post entry.

Got More Examples or Have Questions?

Please share them by commenting on this blog post.

Keywords:

  • tt_news, typo3, news as products, news in menu, paged news, news by topic, popular posts, archive menu

Please Share This Post

Tweet thisRedditBookmark on deliciousStumble thisShare on Facebook

Send this article via email to your friends and peers.

Leave a Comment

Add comment

* - required field







Notify me when a new comment is added.