[TYPO3-english] Make php script as a content element
"André L. Keidser"
andre at seigan.se
Wed May 27 02:02:58 CEST 2009
Hi
Thanks!! When I changed the function name so it began with user_ it
worked correctly.
Cheers
André
Peter Niederlag skrev:
> 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é
>>
>
>
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.339 / Virus Database: 270.12.39/2134 - Release Date: 05/25/09 18:14:00
>
>
More information about the TYPO3-english
mailing list