tt_news

1.3.10. The SINGLE view

The complete view of a news article (single view) has some special features that are not available in LIST or LATEST.

Pagebreaks

When you have long articles in SINGLE view, you might want to split them into multiple pages and have a page navigation inserted to navigate between these split pages.

This can be done automatically by specifying the amount of words after that a pagebreak is inserted. When the amount of words is reached, the extension looks for the next dot (.) and inserts a pagebreak after it (default). Alternatively you can configure tt_news to insert pagebreaks only after paragraphs (an empty line in the bodytext field) by setting "useParagraphAsPagebreak=1".
You can disable this feature for each news record ("No automatic pagebreaks for this record").

You can also add a manual pagebreak at a specific position in the text. At the desired position, enter the text:
"<---newpage--->" (default) or the string that you configured as "pagebreakToken". This will trigger a pagebreak at this position. On the new page, the wordcounter starts again for automatic pagebreaking. However, manual pagebreaks work even when the automatic pagebreak feature is disabled.

The subheader is by default only displayed on the first page of a single view with multiple pages. If this is not wanted the subheader can be configured to appear on all those pages by setting "subheaderOnAllSViewPages=1".

One thing to note is the way images are handled on multiple pages. The images for the additional pages in single view are asssigned by their position in the Image-list of the news record.

Example: If you have 6 images assigned and "imageCount" for the single view set to "2", then the first 2 images will appear on the first page, the second two images at the second page and so on.

There is a seperate marker for the pagebrowser in single view:

###NEWS_SINGLE_PAGEBROWSER###

Alternatively it is possible to simply append the pagebrowser to the bodytext without a special marker by setting "appendSViewPBtoContent=1" (this is the default).

Example:

  # TS setup
  plugin.tt_news {
    useMultiPageSingleView = 1
    pageBreakToken = <break>
    maxWordsInSingleView = 300
    useParagraphAsPagebreak = 1
    subheaderOnAllSViewPages = 0
    appendSViewPBtoContent = 0
  }

This will enable the pagebrowser for the Single view. The string "<break>" will trigger a manually pagebreak. If the text is longer than 300 words, a pagebreak will be inserted automatically after the next paragraph (an empty line in the field bodytext). The subheader will be displayed only on the first page and the pagebrowser will be rendered to its own marker (###NEWS_SINGLE_PAGEBROWSER###).

For a detailed description of the TypoScript options that are mentioned here, take a look at the section "Reference".

Related news or related pages

The news records that are inserted in the field "Related news" in the tt_news db-record are shown in the single view. If those records are "normal news", their links point to the single view of the related news article. Related news with type "link external URL" or "link internal page" will link directly to the url or page id that is configured in the news record.

Additionally to news records, relations can also point directly to internal pages. Related pages will be handled as news that link to internal pages.

tt_news can be configured to insert the link that points back from the related record to the current one automatically. This feature can be enabled by setting "useBidirectionalRelations" to 1.

The display of related news and pages is configured by TypoScript. For more information search for "getRelatedCObject" in the section reference of this manual.  The details of the link configuration can be found in the section "Link Configuration".

Related news by category

The single view can also be configured to show a list of news articles with the same category as the current article. The feature is disabled by default and can be enabled by setting "showRelatedNewsByCategory=1".

If news with the same category are found, they will be rendered as news LIST to the marker "###NEWS_RELATEDBYCATEGORY###". The header will be rendered to the marker "###TEXT_RELATEDBYCATEGORY###".

 


By default the code LIST causes tt_news to render the content to the template  ###TEMPLATE_LIST### This can be changed with "altMainMarkers" to take an userdefined template instead which f.e contains only the news titles. The template for "related news by category" is included in the file tt_news_v2_template.html -> part: "###TEMPLATE_CAT_RELATED###"

Example:

Add the following lines to the setup field of an +ext (TS) template which is located in the page with the SINGLE view content element. Then "related news by category" should look like the screenshot above.

  plugin.tt_news {
    # wrap for all related news by category
    relatedByCategory_stdWrap.wrap =  <dl class="news-single-related">|</dl>
    # wrap for the header
    relatedByCategoryHeader_stdWrap.wrap = <dt>|</dt>
    # globalwrap 3 is used to wrap the list items
    wrap3.wrap = <dd>|</dd>

    # change the name for template LIST to TEMPLATE_CAT_RELATED
    altMainMarkers.TEMPLATE_LIST = TEMPLATE_CAT_RELATED
    altMainMarkers.TEMPLATE_LIST.wrap = ### | ###
  }

Hint:

If you have more than one SINGLE view in your website you can use the TypoScript condition below for changing the template part with "altMainMarkers" - It's not needed to add an +ext template to each SINGLE view page.

  # this changes the template part for list only if a SINGLE view was requested
  [globalVar = GP:tx_ttnews|tt_news > 0]
  plugin.tt_news {
    altMainMarkers.TEMPLATE_LIST = TEMPLATE_CAT_RELATED
    altMainMarkers.TEMPLATE_LIST.wrap = ### | ###
  }
  [global]

To top


Valid XHTML 1.0!