How to get current page title in extension of typo3

Following script will help you for display current page title in your extension.

//Get the current page Title
$currenttitle  = $GLOBALS['TSFE']->rootLine;

I hope it will work for you. Good Luck 😉

If you have any query then feel free to contact me at Jainish Senjaliya

How to upload image in frontend side of typo3 extension development

Here from a form to upload a small controller function into extbase images:

Whenever we upload image from frontend side that every time we must need to check image is exist or not. if image is exists then we need to rename image with unique name.

Following code will help you for how to image upload from frontend side with clean file name


  // check the form is submit
  if ($this->request->hasArgument('submit')){
    // Get all submitted post data 
    $userData = $this->request->getArguments();

    // media is stand for your file name [ you will get data of image]

    $file['name']    = $userData['media']['name'];
    $file['type']    = $userData['media']['type'];
    $file['tmp_name']  = $userData['media']['tmp_name'];
    $file['size']    = $userData['media']['size'];

    // Store the image file
    $files = $this->uploadFile($file['name'], $file['type'], $file['tmp_name'], $file['size']);  

   * uploadFile
   * @param $name
   * @param $type
   * @param $temp
   * @param $size
   * @return
  protected function uploadFile($name, $type, $temp, $size) {
    if($size > 0) {
      $basicFileFunctions = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_basicFileFunctions');
      // upload folder path
      $uploadPath = 'fileadmin/user_upload/jainish';
      $name = $basicFileFunctions->cleanFileName($name);
      $uploadPath = $basicFileFunctions->cleanDirectoryName($uploadPath);
      $uniqueFileName = $basicFileFunctions->getUniqueName($name, $uploadPath);
      $fileStored = move_uploaded_file($temp, $uniqueFileName);
      $returnValue = basename($uniqueFileName);
    return $returnValue;

I hope above code will work for you and made your day 😉 enjoy 🙂

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to set custom label in index search extension of typo3.

Following typoscript will used for set label via typoscript for index search extension{
      default_search_word_entry = Suche
      submit_button_label = Suchen
      opt_type_0 = Distinct word = Ganzes Wort
      opt_type_1 = Part of word = Ein Teil des Wortes
      opt_type_2 = First part of word = Erster Teil des Wortes
      opt_type_3 = Last part of word = Letzter Teil des Wortes
      opt_type_10 = Sounds like = Klingt wie
      opt_type_20 = Sentence = Satz
      opt_defOp_0 = Aller Wörter (UND)
      opt_defOp_1 = Aller Wörter (ODER)
      opt_sections_0 = Ganze Seite
      opt_sections_-1 = Nur diese Seite
      opt_sections_-2 = Top + level 1
      opt_sections_-3 = Level 2 and out
      opt_freeIndexUid_-1 = Alle, vermischt/gemischt
      opt_freeIndexUid_-2 = Alle, kategorisiert
      opt_freeIndexUid_0 = Seiten
      opt_freeIndexUid_header_-1 = Mixed categories = gemischte/vermischte Kategorien
      opt_freeIndexUid_header_0 = Website Pages
      opt_media_-1 = All media = Alle Medien
      opt_media_0 = Internal pages = Interne Seiten
      opt_media_-2 = Alle Externen
      opt_order_rank_flag = Weight/Frequency
      opt_order_rank_freq = Frequency = Häufigkeit
      opt_order_rank_first = Close to top
      opt_order_rank_count = Number of words = Anzahl der Wörter
      opt_order_mtime = Date Modified = Datum bearbeitet
      opt_order_title = Document title = Dokumenttitel
      opt_order_crdate = Creation date = Erstelldatum
      opt_group_sections = Bereichhierarchie
      opt_group_flat = Flat list
      opt_lang_-1 = All languages = Alle Sprachen
      opt_lang_0 = Default = Voreinstellung
      opt_desc_0 = Highest first = Höchstes/Höchster zuerst
      opt_desc_1 = Lowest first = Niedrigstes/Niedrigster zuerst
      opt_RL1 = Level 1:
      opt_RL1ALL = All pages on level 1
      opt_RL2 = - Level 2:
      opt_RL2ALL = - All pages on level 2
      form_legend = Suchformular
      form_searchFor = Suche nach:
      form_extResume = Extended resume = Erweiterte Vorschau
      form_atATime = at a time = Zu einem Zeitpunkt
      form_orderBy = Order by: = Ordnen nach:
      form_fromSection = From section: = Aus dem Bereich
      form_freeIndexUid = Category: = Kategorie:
      form_searchIn = Search in: = Suche in:
      form_match = Match: = Ãœbereinstimmung
      form_style = Style: = Stil:
      rules_header = Rules: = Regeln:
      rules_text = Only words with 2 or more characters are accepted = Das Wort muss 2 oder mehr Buchstaben enthalten
Max 200 chars total
Space is used to split words, "" can be used to search for a whole string (not indexed search then)
AND, OR and NOT are prefix words, overruling the default operator
+/|/- equals AND, OR and NOT as operators.
All search words are converted to lowercase.
      searchFor = Suche nach
      searchFor_or = or = oder
      searchFor_and = and = und
      searchFor_butNot = but not = aber nicht
      noResults = Keine Resultate.
      inSection = in the section = in dem Bereich
      inNsection = in %s section:
      inNsections = in %s sections:
      word_page = page
      word_pages = pages
      unnamedSection = Andere
      link_regularSearch = Regular search = normale Suche
      link_advancedSearch = Advanced search = erweiterte Suche
      res_path = Pfad
      res_modified = Ãœberarbeitet
      res_created = Erstellt:
      res_size = Größe
      res_noResume = Notiz: Keine übereinstimmungen gefunden. Die Seitenvorschau kann nicht angezeigt werden.
      res_otherMatching = übereinstimmende Seiten im gleichen Dokment:
      res_otherPageAsWell = INFO: There was another page indexed as well... Probably indexed with another or no usergroup.
      res_memberGroups = Require membership of group numbers %s
      pi_list_browseresults_prev = <>
      pi_list_browseresults_display = Zeige ###TAG_BEGIN###%s bis  %s###TAG_END### von  ###TAG_BEGIN###%s###TAG_END###
      local_operator_AND = AND = UND
      local_operator_OR = OR = ODER
      local_operator_NOT = NOT = NICHT
      makerating_addToCurrentSearch = Add to current search words = Zu den aktuellen Suchwörtern hinzufügen
      maketitle_matches = matches = übereinstimmend / übereinstimmende Ergebnisse

Above label is for german language.

if we want to change for other language like italy then we can use following script

Note : it is stand for language code

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How do we get root page id and root page title of current page in typo3

If we are on 3rd level of page that time we need root page id of current page then following script will help you more.


you will get root page id of current page

Id you want to root page title then you may use following script


If you want all the level of the page tree then you will get array all array from following script

Simply print the following function you will get all level of page tree


I hope it will work for you and make your day 😉

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

readLLXMLfile error in typo3 extbase extension

While TYPO3 update to TYPO3 6.2 and Pi-Based Extensions throws error of “t3lib_div::readLLXMLfile” which is deprecated in typo3 6.2.xx version

updating TYPO3 from 4.5 to 6.2 version many Pi-Based Extension adjustments a particularly annoying bug has stayed with us.

For me, this error has only be shown if a new content item in the backend should be created.

The error was in the PI1, PI2, … ” … wizcon.php “file and generated a 500 error.

Following error may show in your backend area

( ! ) Fatal error: Call to undefined method TYPO3\CMS\Core\Utility\GeneralUtility::readLLXMLfile() in C:\wamp\www\typo3\jainish\typo3conf\ext\js_contact_form\pi1\class.tx_jscontactform_pi1_wizicon.php on line 72


t3lib_div :: readLLXMLfile is not supported in latest version of typo3. we have to replace those deprecated function to new function

To correct the problem, you have to replace both line.

$llFile = t3lib_extMgm::extPath('YOUR_EXTENSION').'locallang.xml';
$LOCAL_LANG = t3lib_div::readLLXMLfile($llFile, $GLOBALS['LANG']->lang);

// New Code 
$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('YOUR_EXTENSION').'locallang.xml';						
$parser = t3lib_div::makeInstance('t3lib_l10n_parser_Llxml');
$LOCAL_LANG = $parser->getParsedData($llFile, $GLOBALS['LANG']->lang);

I hope this will work for you.

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to readout an image in a Fluid template and give it a click enlarge function in DCE typo3 + FAL

How to wrap image with link in DCE + FAL

For set link around image with same resource you have to use “<f:uri.image>” following example will help you more.

Your fluid template gets an array of FileCollection models,

Following example will show you how to output several images from the FileCollection and wrap with link with same image resource

TCA Configuration for FAL – File Abstraction Layer

    <foreign_types type="array">
        <numIndex index="2">






Template content (fluid)

<f:for each="{dce:fal(field:'gallery', contentObject:contentObject)}" as="fileReference" iteration="iterator" >
   <a href='<f:uri.image src="{fileReference.uid}" treatIdAsReference="1" />'  rel="gallery" title="" class="fancybox" >
       <f:image src="{fileReference.uid}" alt="" treatIdAsReference="1" class="icon" />

The loop run through the complete FAL image list.

The if condition in the treatIdAsReference is recommended because FileCollections returns different types of objects depending of the type of the collection.

Folder based collections returns the file directly, static based collections a file reference. With this condition both cases are covered.

This was for FAL – File Abstraction Layer.

Now we look for simple upload image [ Systems file collections ]

If you have use file collections and you have defined a field in DCE where you can select images than you can access the file name in the Fluid template.

The location where the image is stored is also defined in the TCA, which is mostly something like uploads/pics.

TCA Configuration for simple file upload


Note : Since version 0.11.x of DCE you are. Just add a group field, set allowed tablename to “sys_file_collection” and add the dce_load_schema option.

In the Fluid template you can write following script:

<a href="{f:uri.image(src:'uploads/pics/{field.yourPicture}')}" >
    <f:image src="uploads/pics/{field.yourPicture}" alt="" maxWidth="150" maxHeight="150" />

I hope this will work for you 🙂

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to add elements to the Content Element Wizard in typo3

The content element wizard can be fully configured using TSConfig.

The API described here should not be used for the purpose of customizing this wizard.

However for extension authors, it provides a way of registering their plugin with the new content element wizard.

Basically it is about adding a class reference to the $GLOBALS[‘TBE_MODULES_EXT’][‘xMOD_db_new_content_el’][‘addElClasses’] global array.

The keys in this array are class names and the values are the absolute paths to these class. The class must have a proc() method.

Here is some code from the “js_contact_form” extension, to register the “contactform” plugin with the wizard. First of all, the class is declared:

// add wizard icon to the "add new record" in backend
if (TYPO3_MODE == "BE") {
    $TBE_MODULES_EXT["xMOD_db_new_content_el"]["addElClasses"]["JsContactFormWizicon"] =
         \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Classes/Helper/JsContactFormWizicon.php';

The EXT:js_contact_form/Classes/Helper/JsContactFormWizicon.php file looks like:

 * Created by Jainish Senjaliya.
 * User: Jainish
 * Date: 13.06.2015
 * Time: 15:01
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

 * Class that adds the wizard icon.
class JsContactFormWizicon {

     * Processing the wizard items array
     * @param array $wizardItems : The wizard items
     * @return Modified array with wizard items
    function proc( $wizardItems ) {

        $wizardItems['plugins_tx_jscontactform_contactform'] = array(
            'icon' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('js_contact_form') . 'Resources/Public/Icons/wizard_icon.png',
            'title' => $GLOBALS['LANG']->sL('LLL:EXT:js_contact_form/Resources/Private/Language/locallang.xlf:plugin-title'),
            'description' => $GLOBALS['LANG']->sL('LLL:EXT:js_contact_form/Resources/Private/Language/locallang.xlf:plugin-description'),
            'params' => '&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=jscontactform_contactform'

        return $wizardItems;

The proc() method receives the list of existing items in the wizard and adds a new one to it.

The first three properties (icon, title and description) are quite easy to understand.

The “params” property defines the default values to be added to the new record link so that the right type of content element (and plugin in this case) is already selected.

The entry added in the plugin list of the new content element wizard

The entry added in the plugin list of the new content element wizard

I have taken this example from Contact Form Extension from TYPO3 Repository. you may download and analyze this extension.

I hope this will help you more. Njoy 🙂 🙂

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya