[TYPO3-english] Make php script as a content element
"André L. Keidser"
andre at seigan.se
Tue May 26 17:14:24 CEST 2009
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é
More information about the TYPO3-english
mailing list