typo3typoscript

TYPO3 11 felogin with typoscript


TYPO3 11.5.2

  1. I want to display felogin using typoscript with a customized template at position: <f:cObject typoscriptObjectPath="lib.loginBox" />
  2. The original template should be used if felogin is added as a page content element.

The following code works, but changes the view for all felogins:

plugin.tx_felogin_login {
  settings.pages = 15
  view {
      templateRootPaths {
        0 = fileadmin/template/current/felogin/Resources/Private/Templates/
        10 = {$plugin.tx_felogin_login.view.templateRootPath}
      }
  }
}
lib.loginBox = USER
lib.loginBox {
  userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
  extensionName = Felogin
  pluginName = Login
}

To apply different templates for 1) and 2) I thought the following could work, but it doesn't:

lib.loginBox = USER
lib.loginBox {
  userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
  extensionName = Felogin
  pluginName = Login
  settings < plugin.tx_felogin_login.settings
  settings.pages = 15
  view < plugin.tx_felogin_login.view
  view {
      templateRootPaths {
        0 = fileadmin/template/current/felogin/Resources/Private/Templates/
        10 = {$plugin.tx_felogin_login.view.templateRootPath}
      }
  }
}

EDIT: the second version does not use the custom template at all and the settings.pages = 15 doesn't work => no login possible. With the first version login is working.

Any hints what's wrong with this approach? How I can achieve different templates for 1) and 2) ?

Edit: Solution as it works for me now:

plugin.tx_felogin_login {
  settings.pages = 15
}
lib.loginBox = USER
lib.loginBox {
  userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
  extensionName = Felogin
  pluginName = Login
  view < plugin.tx_felogin_login.view
  view {
      templateRootPaths {
        10 = {$plugin.tx_felogin_login.view.templateRootPath}
        #20 = fileadmin/template/current/felogin/Resources/Private/Templates/
        #should be something like:
        20 = EXT:myfelogin/Resources/Private/Templates/
      }
  }
}

Solution

  • Problem is the sorting of your templates!

    lib.loginBox = USER
    lib.loginBox {
      userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
      extensionName = Felogin
      pluginName = Login
      settings < plugin.tx_felogin_login.settings
      settings.pages = 15
      view < plugin.tx_felogin_login.view
      view {
          templateRootPaths {
            10 = {$plugin.tx_felogin_login.view.templateRootPath}
            20 = fileadmin/template/current/felogin/Resources/Private/Templates/
          }
      }
    }
    

    As 20 is higher than 10, the template in fileadmin will be used.


    Just as side note: you should always create a site package extension containing all those files and not put them into fileadmin.