> ## Documentation Index
> Fetch the complete documentation index at: https://docs.t3planet.de/en/latest/llms.txt
> Use this file to discover all available pages before exploring further.

# For Developers

## ViewHelpers

We have added a few ViewHelpers with this extension to get date of last comment in a News and to get count of number of comments in each News.

For this, you have to add a Namespace of ViewHelper.

```language theme={"theme":{"light":"github-light","dark":"github-dark"}}
xmlns:nscomment="http://typo3.org/ns/Nitsan/NsNewsComments/ViewHelpers"
```

Check this for more details:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/t3planet/en/latest/ExtNsNewsComments/ForDevelopers/images/add_namespace.webp" alt="Add namespace" />

## Get Date of Last comment in a News

To get date of last comment in a news, add following code.

```language theme={"theme":{"light":"github-light","dark":"github-dark"}}
<f:for each="{nscomment:lastComment(newsuid: newsItem.uid)}" as="newsComment">
 | Last Comment on <f:format.date format="d.m.Y">{newsComment.crdate}</f:format.date>
</f:for>
```

Check this for more details:

<img src="https://mintcdn.com/t3planet/dI7I5_rtIfJq6RpY/en/latest/ExtNsNewsComments/ForDevelopers/images/get_date_of_last_comment.webp?fit=max&auto=format&n=dI7I5_rtIfJq6RpY&q=85&s=06faf8ec7187d182f5bb0659ca38783d" alt="Get date of Last Comment" width="1106" height="265" data-path="en/latest/ExtNsNewsComments/ForDevelopers/images/get_date_of_last_comment.webp" />

## Get count of number of comments in a News

To get date of last comment in a news, add following code in List.html

```language theme={"theme":{"light":"github-light","dark":"github-dark"}}
Comments: {nscomment:count(newsuid: newsItem.uid)}
```

Check this for more details:

<img src="https://mintcdn.com/t3planet/dI7I5_rtIfJq6RpY/en/latest/ExtNsNewsComments/ForDevelopers/images/get_count_of_comments.png?fit=max&auto=format&n=dI7I5_rtIfJq6RpY&q=85&s=2db25837bfc5ec711ef43b8c6a81a8df" alt="Get count of comments" width="1287" height="141" data-path="en/latest/ExtNsNewsComments/ForDevelopers/images/get_count_of_comments.png" />

<Note>
  Above ViewHelpers are supported in V8, V9 & V10 only.
</Note>

## Routing in TYPO3 9 & 10

Since version 9.5, TYPO3 supports speaking URLs and if you have used the typeNum for any Ajax related work then you also need to add **routeEnhancers** like **routeEnhancers > PageTypeSuffix > map > nsnewscomment: 99** in your site configuration.

```YAML theme={"theme":{"light":"github-light","dark":"github-dark"}}
routeEnhancers:
  PageTypeSuffix:
    type: PageType
    default: /
    index: ''
    map:
      /: 0
      nsnewscomment: 99
```

<img src="https://mintcdn.com/t3planet/dI7I5_rtIfJq6RpY/en/latest/ExtNsNewsComments/ForDevelopers/images/route_enhancer.webp?fit=max&auto=format&n=dI7I5_rtIfJq6RpY&q=85&s=1f55a67f834c93fd9d0adc028ec14861" alt="Route Enhancer" width="806" height="848" data-path="en/latest/ExtNsNewsComments/ForDevelopers/images/route_enhancer.webp" />
