Typo3 Php

        Let’s check a few php codes related to typo3:-

  1. Php code to fetch extension configuration values from extension manager configuration tab fields

    $variable_name = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ext_name']); //returns an array.

    Ext_name should be replaced with the extension key.

    Sample code for getting the language keys given in lfeditor “viewlanguages” field:

    $language_keys_ext = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['lfeditor']);
    $languages_keys = $language_keys_ext['viewLanguages'];
  2. Disable Cache in Typo3 Extension

    Remove the code from class.tx_extname_pi?.php (extension class file)

    var $pi_checkCHash = true;

    And add the following code in main function.

  3. Check typo3 version using php

    Use any of the following codes:

    • if (t3lib_div::int_from_ver(TYPO3_version) >= 4003000) {
      // Code for 4.3 and above
      } else {
      // Code up to 4.2
    • $version = class_exists('t3lib_utility_VersionNumber')
      ? t3lib_utility_VersionNumber::convertVersionNumberToInteger( TYPO3_version )
      : t3lib_div::int_from_ver(TYPO3_version);
      if ($version >= 4003000) {
      // Code for 4.3 and above
      } else {
      // Code up to 4.2

    • if ( $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'] >= 4.7)
      // Code for 4.7 and above
      } else {
      // Code up to 4.7

    Reference link: http://forge.typo3.org/projects/typo3v46-projects/wiki/Compatibility_code_with_older_TYPO3_versions

  4. Get SQL-Query from exec_SELECTquery or code to show the last executed query in typo3.

    //add the below code before the query is executed.

    $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = 1;

    // exec_SELECT query
    $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, $from_table,$where_clause,$groupBy,$orderBy,$limit);

    // the display the last SQL-Statement
    echo $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;

  5. Php code to get the value of record storage folder selected in page

    $storpid = $this->cObj->data['pages'];
    $this->id = $storpid?$storpid:$GLOBALS['TSFE']->id; //if storage folder is selected the that value will be taken, otherwise the current page id.
  6. Php code to access values from Typo3 template/Typoscript


    can be used to fetch data from the below typoscript:-

    page.config.language = en

    written in setup section.

  7. Acquire locallang.xml values

    Basically there are two approaches:

    • Call $LANG->getLL(“label_key”)
    • Call $LANG->sL(“LLL:[file-reference of locallang file]:[key-name]”)

    Reference link:http://typo3.org/documentation/document-library/core-documentation/doc_core_inside/4.1.0/view/3/8/

  8. Check IP using Typoscript, Php, Javascript:


    [IP = 121.*.*.*] or [globalString = IENV:REMOTE_ADDR = 121.*.*.*]



    if ($_SERVER['REMOTE_ADDR']=="121.*.*.*"){


    alert( "Your ip: " + data.ip);
Typo3 Php
  1. I do not even know the way I ended up here, however I assumed this publish used to be great. I do not recognise who you’re however certainly you are going to a famous blogger if you happen to are not already. Cheers!


  2. Today, I went to the beachfront with my children.

    I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed.
    There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is totally off topic
    but I had to tell someone!


  3. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a
    comment is added I get several emails with the same comment.
    Is there any way you can remove people from
    that service? Appreciate it!


    • Sankar says:

      Sorry. I don’t know about it as it’s a default wordpress feature and this is a free blog.
      Also some uncaught spam comments are getting added to this article and I remove them within a day.


How's it? Your comments and suggestions...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s