Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6565883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:09:00+00:00 2026-05-25T14:09:00+00:00

I need to create links to the frontend website inside a scheduler task. I’ve

  • 0

I need to create links to the frontend website inside a scheduler task. I’ve searched and looked around and what I have found is an example script that initiates the TSFE. After that I can initiate tslib_cObj to create some links; I thought.

But what I get is a recursion error as soon as I try to create a typolink using $cObj->typoLink_URL(1); fe. or any other method that allows creating a typolink.

The following is the script I use to initiate the TSFE inside $GLOBALS, just like when working inside an extension in the frontend:

<?php
function initTSFE($pageUid = 1, $overrule = FALSE) {
    // declare
    $temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');

    // begin
    if (!is_object($GLOBALS['TT']) || $overrule === TRUE) {
        $GLOBALS['TT'] = new t3lib_timeTrack;
        $GLOBALS['TT']->start();
    }

    if ((!is_object($GLOBALS['TSFE']) || $overrule === TRUE) && is_int($pageUid)) {
        // builds TSFE object
        $GLOBALS['TSFE'] = new $temp_TSFEclassName($GLOBALS['TYPO3_CONF_VARS'],
            $pageUid, $type=0, $no_cache=0, $cHash='', $jumpurl='', $MP='', $RDCT='');

        // builds rootline
        $GLOBALS['TSFE']->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
        $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pageUid);

            // init template
        $GLOBALS['TSFE']->tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');
        $GLOBALS['TSFE']->tmpl->tt_track = 0;// Do not log time-performance information
        $GLOBALS['TSFE']->tmpl->init();

        // this generates the constants/config + hierarchy info for the template.
        $GLOBALS['TSFE']->tmpl->runThroughTemplates($rootLine, $start_template_uid=0);
        $GLOBALS['TSFE']->tmpl->generateConfig();
        $GLOBALS['TSFE']->tmpl->loaded=1;

        // get config array and other init from pagegen
        $GLOBALS['TSFE']->getConfigArray();
        $GLOBALS['TSFE']->linkVars = ''.$GLOBALS['TSFE']->config['config']['linkVars'];

        if ($GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP']) {
            foreach (t3lib_div::trimExplode(',',$GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'],1) as $temp_p) {
                $GLOBALS['TSFE']->pEncAllowedParamNames[$temp_p]=1;
            }
        }

        // builds a cObj
        $GLOBALS['TSFE']->newCObj();
    }
}

What I am trying todo in the scheduler task is the following:

<?php
public function execute() {
    $this->initTSFE();
    $cObj = t3lib_div::makeInstance('tslib_cObj');
    var_dump($cObj->getTypoLink_URL(1));exit;
}

This is showing me the following result upon executing this task via the scheduler:
https://i.stack.imgur.com/IbB35.png

Any help is very much appreciated =)

NOTE: The 1 value inside getTypoLink_URL does exist as a page in Typo3.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:09:01+00:00Added an answer on May 25, 2026 at 2:09 pm

    There seems to be something wrong with this initTSFE() method I was trying to use. I am not quit sure what, but I’ve found a different version of it that does seem to work:

    public function initTSFE($pageUid=1) {
        require_once(PATH_tslib.'class.tslib_fe.php');
        require_once(PATH_t3lib.'class.t3lib_userauth.php');
        require_once(PATH_tslib.'class.tslib_feuserauth.php');
        require_once(PATH_t3lib.'class.t3lib_cs.php');
        require_once(PATH_tslib.'class.tslib_content.php');
        require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
        require_once(PATH_t3lib.'class.t3lib_page.php');
    
        $TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
    
        if (!is_object($GLOBALS['TT'])) {
            $GLOBALS['TT'] = new t3lib_timeTrack;
            $GLOBALS['TT']->start();
        }
    
        // Create the TSFE class.
        $GLOBALS['TSFE'] = new $TSFEclassName($GLOBALS['TYPO3_CONF_VARS'],$pageUid,'0',1,'','','','');
        $GLOBALS['TSFE']->connectToMySQL();
        $GLOBALS['TSFE']->initFEuser();
        $GLOBALS['TSFE']->fetch_the_id();
        $GLOBALS['TSFE']->getPageAndRootline();
        $GLOBALS['TSFE']->initTemplate();
        $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
        $GLOBALS['TSFE']->forceTemplateParsing = 1;
        $GLOBALS['TSFE']->getConfigArray();
    }
    

    Thank you voancea!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anybody please give some useful links on this topic.i need to create a content
i need to create a chart similar to this: link text Do you have
I need to create no follow links with link_to . I'm looking for something
I need to create links on webpage which call a javascript function with different
I have a directory with PDF files that I need to create an index
I need to create the following symbolic links into RPM file /bin/ln -sf libcrypto.so.0.9.8e
How do I create subdomains in ASP.NET? I have few links on my homepage(Home.aspx)
I have turn EJB 3.1 into web-service. And now I need to create the
I have a User entity, and in various views, I want to create links
Hello I want to create my sites links to dynamically, and for me need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.