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!

If you have any query then feel free to contact me at Jainish Senjaliya

Advertisements

One thought on “Render tt_content element in extension

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s