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


Top 10 Updates

Using Transparent PNG's in IE5/6 without JavaScript geändert am  04-Oct-2008 12:27:15
Using lightbox without extension geändert am  13-Jun-2008 14:20:51
Custom field for GMENU alt text geändert am  13-Jun-2008 13:58:07
Extending typoscript properties with stdWrap geändert am  13-Jun-2008 13:54:32
Create menus using data from other tables than "pages" V2  geändert am  24-Mar-2008 13:02:09
Login geändert am  17-Mar-2008 12:47:52
Forum geändert am  17-Mar-2008 10:07:47
Who is Typo3wizard.com geändert am  26-Dec-2007 16:07:32
Menu as un-nested lists (iphone navigation) geändert am  29-Oct-2007 15:05:53
IF Conditions with AND and OR operators geändert am  16-Oct-2007 19:16:04
Deutsch
Search: