[TYPO3] Passing content to php functions

Brian typo3-english at lists.netfielders.de
Thu Aug 23 19:29:31 CEST 2007


Suppose I have the following in a file called test.inc\n
<?php
class user_test {
  function testFunc($content, $conf) {
    $content = "<p>Hello world!</p>"; } // end function testFunc($content, $conf) 
} // end class user_test
?>

Using TemplaVoila, I created a section called lib.mysect
and added the following TypoScript

lib.mysect = USER
lib.mysect {
  userFunc = user_test->testFunc
}

What I would like to have happen would be for the content area I've defined with lib.mysect to now contain <p>Hello world!</p>. However, when looking at the page, that does not appear. When I change $content = "<p>Hello world!</p>" to echo "<p>Hello world!</p>", it does print but prints it before any html tags which is not what I want but it  lets me know that communication is happening between the TypoScript and the PHP file. Any thoughts on how to get <p>Hello World!</p> to print in the correct area?

Message was edited by: lokisapocalypse


More information about the TYPO3-english mailing list