Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

user_various Class Reference

Example of calling a method in a PHP class from TypoScript. More...

List of all members.

Public Member Functions

 reverseString ($content, $conf)
 Doing the same as user_reverseString() but with a class.
 listContentRecordsOnPage ($content, $conf)
 Testing USER cObject:.
 selectThem ($query)
 Selecting the records by input $query and returning the header field values.

Public Attributes

 $cObj


Detailed Description

Example of calling a method in a PHP class from TypoScript.

Definition at line 102 of file example_callfunction.php.


Member Function Documentation

user_various::listContentRecordsOnPage content,
conf
 

Testing USER cObject:.

Example can be found in the testsite package at the page-path "/Intro/TypoScript examples/Custom Dynamic Co.../Calling a method.../" This TypoScript configuration will also demonstrate it:

includeLibs.something = media/scripts/example_callfunction.php page = PAGE page.typeNum=0 page.30 = USER page.30 { userFunc = user_various->listContentRecordsOnPage reverseOrder = 1 }

Parameters:
string Empty string (no content to process)
array TypoScript configuration
Returns:
string HTML output, showing content elements (in reverse order if configured.)

Definition at line 143 of file example_callfunction.php.

References header().

00143                                                       {
00144       $query = $GLOBALS['TYPO3_DB']->SELECTquery(
00145                   'header',
00146                   'tt_content',
00147                   'pid='.intval($GLOBALS['TSFE']->id).$this->cObj->enableFields('tt_content'),
00148                   '',
00149                   'sorting'.($conf['reverseOrder'] ? ' DESC' : '')
00150                );
00151       $output = 'This is the query: <strong>'.$query.'</strong><br /><br />';
00152       return $output.$this->selectThem($query);
00153    }

user_various::reverseString content,
conf
 

Doing the same as user_reverseString() but with a class.

Also demonstrates how this gives us the ability to use methods in the parent object.

Parameters:
string String to process (from stdWrap)
array TypoScript properties passed on to this method.
Returns:
string The input string reversed. If the TypoScript property "uppercase" was set it will also be in uppercase. May also be linked.
See also:
user_reverseString()

Definition at line 113 of file example_callfunction.php.

References $content.

00113                                           {
00114       $content = strrev($content);
00115       if ($conf['uppercase']) {
00116          $content=$this->cObj->caseshift($content,'upper');
00117       }
00118       if ($conf['typolink'])  {
00119          $content=$this->cObj->getTypoLink($content,$conf['typolink']);
00120       }
00121       return $content;
00122    }

user_various::selectThem query  ) 
 

Selecting the records by input $query and returning the header field values.

Parameters:
string SQL query selecting the content elements.
Returns:
string The header field values of the content elements imploded by a <br /> tag private

Definition at line 162 of file example_callfunction.php.

References header(), and TYPO3_db.

00162                                  {
00163       $res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db,$query);
00164       $output=array();
00165       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
00166          $output[]=$row['header'];
00167       }
00168       return implode($output,'<br />');
00169    }


Member Data Documentation

user_various::$cObj
 

Definition at line 103 of file example_callfunction.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:07:53 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913