

This Typo3 Code Snippet shows the newest forum post on your page. This snippet was written for the CHC-Forum. The TypoScript code can be easily modified. If you want for example display the 10 latest post on your forum you only have to set the max=10.
If there is no forum post the text "No forum posts" will be shown. If there are forum posts the following information will be shown for the newst one: Topic, first 20 characters of text and the date and time.
The topic will automatically linked to correct thread of the post in the forum, this way you can reach the post very fast.
temp.lastpost=COA_INT temp.lastpost{ 10=CONTENT 10.table=tx_chcforum_post 10.select { #id of the sysfolder where the forum posts are stored pidInList=27 orderBy=tstamp DESC max=1 } 10.renderObj =COA 10.renderObj{ 10=TEXT 10 { field=post_subject wrap=Topic: |<br> #id of the pages where the forum is typolink.parameter=6 typolink.additionalParams.insertData=1 typolink.additionalParams=&thread_uid={field:thread_id}&view=single_thread } 20=TEXT 20 { field=post_text crop=20 wrap=Text: |...<br> } 30=TEXT 30{ field=tstamp strftime=%m/%d/%Y %H:%I:%S wrap=Postet on: | } } 20=TEXT 20.value=No forum posts 20.if.isFalse.numRows < .10 wrap=Our newest forum post:<br>| }
To get this snippet working just copy the code to the TypoScript Setup of your TYPO3 template. Then copy the temporary object to a marker of your choice for example:
page.10.subparts.FORUM < temp.lastpost
More information on this topic can be found here




Add comment