Show newest forum post

Submitting your vote...
Not rated yet. Be the first who rates this item!
Click the rating bar to rate this item.

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:&nbsp;|<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:&nbsp;|...<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

Snippet numRows sample

Snippet typolink sample

 

TSREF Content

TSREF numRows

TSREF select




Comments


April, 12-06-09 12:07:
hi this april i want to register this website

Add comment

* - required field

*



*
*

Top 10 Updates

Nice fonts using Google font API geändert am  20-May-2010 16:36:47
TS-based Searchbox for Indexed Search  geändert am  18-May-2010 18:27:15
TYPO3 SEO geändert am  30-Apr-2010 09:44:22
Search engine friendly graphical headers in TYPO3 geändert am  30-Apr-2010 09:33:44
Creating a simple Infocenter using TYPO3 geändert am  17-Nov-2009 12:12:52
Making the Section Menu work correctly with TemplaVoila geändert am  05-May-2009 12:27:17
Show pages with type "Not in Menu" in a sitemap geändert am  05-May-2009 12:11:17
Implementation of the DHTML menu from brainjar.com  geändert am  01-Feb-2009 14:02:48
Sample DHTML menu geändert am  01-Feb-2009 13:51:25
A introduction to the CONTENT object geändert am  26-Jan-2009 13:20:39

Latest comments

20-Aug-2010 16:31:13
pritam schrieb: Hello, Can any body tell me how to add the realurl in the typo3.
Articles
17-Aug-2010 15:25:30
Graham Solomon schrieb: I have developed a nice extension for using this Google Font API with TYPO3, along with their web...
Nice Fonts using Google font API
12-Aug-2010 17:39:44
Ritesh Jaiswal schrieb: I have added the above code into page template but it is not working. It only index the page into...
Index search
Deutsch
Search: