[Typo3] Using PHP scripts

Amy Thornton amy.thornton at usm.edu
Thu Oct 27 22:21:43 CEST 2005


I am trying to insert content using a PHP script.  I can't figure out why 
it isn't working.  I followed the instructions exactly in Modern Template 
Building, Part 1.

This is the PHP script I have saved in userfunctions.php in the fileadmin 
folder:

<?php
class user_functions {
         /*** Multiplies the current page ID with $conf["factor"] ***/
         function multiplyTest($content,$conf)
                 $currentPageUid = $GLOBALS['TSFE']->id;
                 $factor = intval($conf['factor']);
                 return $currentPageUid * $factor;
         }
}
?>

and this is the TypoScript I'm using in the template Setup:

# Default PAGE object:
page = PAGE
page.typeNum = 0
page.includeLibs.some_random_id_string = fileadmin/userfunctions.php
page.config.admPanel = 1

# Content object outputting current page title:
page.10 = HTML
page.10.value  = The page ID, {field:uid}, multiplied with 15 is:
page.10.value.insertData = 1
page.10.value.wrap = <b> |</b><br />

page.20 = USER
page.20.userFunc = user_functions->multiplyTest
page.20.factor = 15

Any suggestions would be greatly appreciated.

Thanks for your time.  Amy


Amy Thornton, Electronic Services Specialist
Information Services, Cook Library
The University of Southern Mississippi
118 College Drive #5053
Hattiesburg, MS 39406-0001
Phone: (601) 266-6668
Fax: (601) 266-6857
E-mail: amy.thornton at usm.edu
http://www.lib.usm.edu/ 





More information about the TYPO3-english mailing list