[TYPO3-english] Make php script as a content element

Peter Niederlag niederlag at ikd01.de
Tue May 26 18:17:21 CEST 2009


Hello,

Use TypoScript-debugger.

default values:
global function must start with 'user_'
classname must start with either 'user_' or 'tx_'
can be changed in install-tool

Cheers,
Peter


André L. Keidser schrieb:
> Hi all,
> 
> I'm trying to make a php file as a content element. I have done it once
> before for about 6 months ago and think I have copied all off the old
> code but it still it wont work. Can anyone of you please point me in the
> right direction?
> 
> 
> 
> * PHP
> I have a PHP file (my_content_script.inc) with a function that want
> $content and $conf and it return a html snippet. The fram looks like this:
> 
>  function my_function($content, $conf)
>  {
>       $result = "HELLO WORLD <br><br>";
>             print $result;
>        return $result;
>  }
> 
> 
> 
> * TS
> The basic TS template in the first page includs a TS template called
> "my_content_script" that looks like this:
> 
> # SET PHP INCLUDE FILE PATH
> page.includeLibs.my_script = fileadmin/php-scripts/my_content_script.inc
> 
> # SET TT_CONTENT SETTINGS & EXECUTE FUNCTION
> tt_content.script >
> tt_content.script = CASE
> tt_content.script {
>    key.field = select_key
>      my_script = USER
>      my_script .userFunc = my_function
> }
> 
> 
> 
> * CONTENT ELEMENT
> I have a content element that have following settings:
> 
> Type: script
> Name: My script test
> CODE: my_script
> 
> 
> 
> If I execute the function directly in the php file it will execute so it
> has included the file. But it refuces to execute the function where I
> have the content element... Have I missed something or have I just done
> plain wrong?? All tips appreciated!!
> 
> Thanks in advanced!
> 
> Take care
> 
> André


-- 
Peter Niederlag
http://www.niekom.de * TYPO3 & EDV Dienstleistungen *


More information about the TYPO3-english mailing list