[Typo3-dev] Initialization of $T3_SERVICES (Typo3 3.7.0)

Jean-Baptiste RIO TripHot69 at hotmail.com
Sun Jun 5 17:58:38 CEST 2005


I've created a new service (af_xmlfileio). It is declared as :

t3lib_extMgm::addService($_EXTKEY,  'xmlfileio' /* sv type */,
'tx_afxmlfileio_sv1' /* sv key */,
  array(

   'title' => 'XML File I/O',
   'description' => ...
...)
)

It works without any problem when i use it in BE extensions.
I try to use it in an FE extension, but it doesn't work. The FE Extension is
a plugin which is used to fill a Flexform item, declared as Typoscript
object (lib.listofgames). In the TS gabarit of the site, i put

lib.listofgames < plugin.tx_myextension_pi1

The goal is to display the content of the XML file in the page.

In the plugin, i use the function t3lib_div::makeInstanceService to create
the service object as shown below :

  if (is_object($serviceObj = t3lib_div::makeInstanceService('xmlfileio')))
{
    $listofitems =
$serviceObj->load($_SERVER['DOCUMENT_ROOT']."fileadmin/commun/af_items.xml")
;
  }

This function returns empty. I dived into T3 code and i found it's because
the global $T3_SERVICES is not initialized.

So questions :
- Is it possible to use services in FE extensions ?
- If so, did i miss something  when declaring / calling it ?
- Do I have to call a function to initialize the $T3_SERVICES ? If so what
is this function ?

Thanks for the help.






More information about the TYPO3-dev mailing list