RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About
  •  

    Render tt_content element in extension

    If you would like to read and output a normal tt_content record in an extension, you can do the following. In this example I wanted to have an extra remark / reminder when posting a new topic in the extension mm_forum, which a normal editor could edit in a tt_content element for example text.The needed PHP code which can be put in the class ( for example class.tx_mmforum_pi1.php in the function new_topic) :

    $tt_content_conf = array('tables' => 'tt_content'
          ,'source' => 33
          ,'dontCheckPid' => 1
          );
    $extraRemark= $this->cObj->RECORDS($tt_content_conf);

    The source number corresponds with the uid of the content element. You could also make a constant or a flexform value of this,  if you know how to build extensions you probably know how to do this.

    Output :

    Put a marker in the html-template of the extension. In my case this was ###EXTRAREMARK### in new_topic.html

    Fill marker :

    $marker = array(
        '###EXTRAREMARK###'            => $extraRemark,
    etc... );
    

    That’s all!

    Leave a Reply