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

Andreas Förthner Andreas.Foerthner at netlogix.de
Sat Apr 8 15:41:40 CEST 2006


Ricardo Scachetti Pereira schrieb:
>    Hi Oliver,
> 
>    I tried your suggestion but got this error:
> 
> *Fatal error*: Call to a member function on a non-object in *C:\Program 
> Files\Apache 
> Group\Apache2\htdocs\dummy-3.8.0\tslib\class.tslib_content.php* on line 
> *4961*
> 
>    Here's the code where it happens (faulty line marked with >>>):
> 
> function typoLink($linktxt, $conf)    {
> ...
>            // Looking up the page record to verify its existence:
>  >>>     $disableGroupAccessCheck = 
> $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] 
> ? TRUE : FALSE;
>        $page = 
> $GLOBALS['TSFE']->sys_page->getPage($link_param,$disableGroupAccessCheck);
> ...
> }
> 
>    Debuging that bit I checked that the global variable $GLOBALS['TSFE'] 
> is empty. Maybe I need to initialize other stuff as well.
> 
>    In any case, your suggestion is a great lead. I'll let you know if I 
> get it working. Thanks so very much!!
> 
>    Cheers,
> 
> Ricardo
> 
> Oliver Klee wrote:
> 
>> Hi,
>>
>> Ricardo Scachetti Pereira schrieb:
>>  
>>
>>>   I've been trying to render a link to a front-end page on my back-end
>>> module, without success.
>>>
>>>   I've used the pi_getPageLink() function and friends (typolink) in
>>> some plugins I have developed without any problems, but I don't know how
>>> to do the same from my back-end module because I don't have an instance
>>> of the pi_base class at hand.
>>>   
>>
>>
>> What happens if you create a pi_base object for this? Usually, a content
>> object also should suffice as it provides getTypoLink().
>>
>> This may work (not tested):
>>
>> $cObj =& t3lib_div::makeInstance('tslib_cObj');
>> $linkTag = $cObj->getTypoLink('view it', $pageID);
>>
>> Hope this helps,
>>
>>
>> Oliver
>> _______________________________________________
>> TYPO3-dev mailing list
>> TYPO3-dev at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
>>
>>  
>>
> 
Hi,

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?

Greets

Andreas




More information about the TYPO3-dev mailing list