[TYPO3-dev] How to get a link to a FE page from a BE module?

Ricardo Scachetti Pereira ricardo at tdwg.org
Sat Apr 8 16:17:17 CEST 2006


Andreas Förthner wrote:

>this is nothing to wonder about, because the FE won't be initialized in 
>the BE. If you want to use those FE functionality, you must instanciate 
>all those FE classes your functions depend on. Did you instnaciate the 
>classes?
>  
>
    Hi Andreas,

    I'm trying to, but it looks like I'm never going to get it right. 
Here's what I have. I'm calling the following function I wrote from my 
BE module main function:

    function setGlobalObjects()
    {
        global $GLOBALS, $TSFE, $TYPO3_CONF_VARS;
       
        $temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
        $TSFE = new $temp_TSFEclassName(
                $TYPO3_CONF_VARS,
                t3lib_div::_GP('id'),
                t3lib_div::_GP('type'),
                t3lib_div::_GP('no_cache'),
                t3lib_div::_GP('cHash'),
                t3lib_div::_GP('jumpurl'),
                t3lib_div::_GP('MP'),
                t3lib_div::_GP('RDCT')
            );

        $temp_TTclassName = 
t3lib_div::makeInstanceClassName('t3lib_timeTrack');
        $GLOBALS['TT'] = new $temp_TTclassName();
        $GLOBALS['TT']->start();

            // get extension confArray
        $confArray = 
unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['tdwg_track']);
       
        $TSFE->id = $confArray['pidToDisplayStandardDraft'];
        $TSFE->initLLVars();
        $TSFE->initFEuser();
        $TSFE->initUserGroups();
        $TSFE->initTemplate();
        $TSFE->connectToDB();
        $TSFE->determineId();
        $GLOBALS['TSFE'] = $TSFE;
    }

    But when I call getTypoLink(186), I get this URL "?id=186"

    It looks like that these calls are not initializing $TSFE->tmpl 
correctly.

    Anyway, by looking at the code I wrote, it looks like I'm rather 
desperate :(

    Is it a proper way to initialize the $TSFE object?

    Thanks for the hint.

    Cheers,

Ricardo

>Greets
>
>Andreas
>_______________________________________________
>TYPO3-dev mailing list
>TYPO3-dev at lists.netfielders.de
>http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
>
>  
>





More information about the TYPO3-dev mailing list