Montag, 28. Februar 2011

Call user functions with USER_INT

Custom PHP in Typoscript

These two listing just shall show you a working example of calling custom PHP functions from Typoscript. I just publish this because in all the existing examples I found some details were missing.

The following listing shows usage of USER_INT which causes no caching of this content element. Please note that your class needs to have a prefix "user_" to be excuted via userFunc. Use admin panel to get according feedback.

includeLibs.hashTools = fileadmin/hashTools.php
page.200 = USER_INT
page.200 {
  userFunc = user_MyTools->testFunction
 }

Following PHP listing shows a simple function to be called via Typoscript.
<?php

class user_MyTools {

  function testFunction($content,$conf) {
     return "Hallo Welt!";
  }

}

?>

Keine Kommentare:

Kommentar veröffentlichen