[TYPO3-english] Cannot get getTypoLink_URL function to work in my eID extension

Stephan Schuler Stephan.Schuler at netlogix.de
Fri Jun 7 10:38:20 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hey there.


Just like Richard says: There is no TSFE in eID calls.
TSFE brings lots of stuff, including completely rendered TypoScript, which is based on having a proper target page id detected.
As long as you don't do something that relies on having a certain page id detected and you don't need any TypoScript, it's not necessary to have TSFE in place in eIDs.
Another thing missing in eID environment is fe_users. You need fe_users to determine if the current user has access to a certain page, and the current fe_user influences TypoScript condition.

But you can make the eID create one: Call tslib_eidtools::initFeUser();

The created eID script determines the root of your domain as target page. I haven't thought about any way around this, but it was simply not necessary for me.

This has been discussed a lot in the past. There are several threads about creating a TSFE, most of them include lots of "t3lib_div::makeInstance". I guess they were either created before tslib_eidtools::initFeUser() was introduced or they just copied from other old examples.
I really prefer the eidtools mechanism, since it's build exactly for one purpose: Enable eID to initialize just as much framework as needed for a certain eID task.

http://forum.typo3.org/index.php/t/194713/#msg_676854


Kind regards,


Stephan Schuler
Web-Entwickler

Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Website: media.netlogix.de



- --
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Neuwieder Straße 10 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt



- -----Ursprüngliche Nachricht-----
Von: typo3-english-bounces at lists.typo3.org [mailto:typo3-english-bounces at lists.typo3.org] Im Auftrag von Richard Davies
Gesendet: Donnerstag, 6. Juni 2013 01:15
An: TYPO3 English
Betreff: Re: [TYPO3-english] Cannot get getTypoLink_URL function to work in my eID extension

Hi Benoit,

If you get an error, check your logs. It will tell you what issue occurred.
Most likely it is because getTSFE is a private method (you can't call it).
- From the look of this method (in 4.5) this doesn't do what you want anyway
- - it doesn't init the TSFE with enough information for link creation to work.

If you search the archives for the mailing list you will see a lot of emails about using TSFE in eID scripts. There are a few options: creating the TSFE manually - http://stackoverflow.com/questions/7835380/typo3-eid-how-to-access-config,
or just calling a typo3 page that has the plugin on it (either directly or from your eID script) to avoid playing around with TSFE creation.

Richard

On 6 June 2013 10:33, Benoit Montereau <bmontereau at gmail.com> wrote:

> I'm runnign Typo3 4.7.4
>
> In order to execute ajax call through my Typo3 website, I just added
> my own "extension" as an "eID_include".
>
> Everything issetup and working fine (also databse connection &
> queries) as long as my extension is not trying to call Typo3 function.
>
> My extension should return a link definition as a string and I cannot
> get the getTypoLink_URL to work.
>
> As soon as I added in the init() function of my class the
>
> $TSFEObject = tslib_eidtools::getTSFE(); I get an error http 500
>
> Same error, occurs if this line is not present and I try to get the
> link definition using.
>
> So is it definitely not possible to call this function in my own eID
> extension or am I doing something wrong here?
>
> Thank you in advance for your help.
> Ben
>
>
>
> <?php
> if (!defined ('PATH_typo3conf')) die ('Could not access this script
> directly!');
>
> require_once(PATH_tslib. 'class.tslib_pibase.php');
> require_once(PATH_t3lib . 'class.t3lib_befunc.php');
> require_once(PATH_t3lib . 'stddb/tables.php');
> require_once(t3lib_extMgm::extPath('cms', 'ext_tables.php'));
>
> class tx_cascade_page_eid extends tslib_pibase { public function
> init() {  // initiate feobject $this->feUserObj =
> tslib_eidtools::initFeUser(); //$TSFEObject =
> tslib_eidtools::getTSFE(); // initiate database
> tslib_eidtools::connectDB(); } public function main() { // get params
> for query  $param = t3lib_div::_GET(); $st = $param['st']; if($st >
> 3){ return; } $name = $param['name'];
>
> $pageid = 469;
> // $href = $GLOBALS['TSFE']->cObj->getTypoLink_URL($pageid);
> $href = $this->cObj->getTypoLink_URL($pageid);
> echo "hello world $name / $href";
>  }
> }
>
> if (defined('TYPO3_MODE') &&
>
> isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/cascade_p
> age/class.tx_cascade_page_eid.php']))
> {
>
> include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/ca
> scade_page/class.tx_cascade_page_eid.php']);
> }
>
> $module = t3lib_div::makeInstance('tx_cascade_page_eid');
> $module->init();
> $module->main();
> ?>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english

-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 3.3.0 (Build 8741)
Charset: utf-8

wpUDBQFRsZv+pp0IwsibV8MBCCfCA/9m0nkmvNSXfJM2j3LAJ/tF+H+44ekL3fTF
q9b3T0syQQnExpSYxU74edbRVaLLHgxTg/sR2mi1yuQGuCHLMLD//S1jgk5H2Y7E
K95geLKbjb86ZaHCcP53USrwN09zu2VjL3A4+eZhEyJHewIjGG57PPjd2zNnJr1y
oVxw0hWMrA==
=XFix
-----END PGP SIGNATURE-----


More information about the TYPO3-english mailing list