title: How to generate URLs in a TYPO3 scheduler task for a tt_news record?
body: <p>I am currently writing a scheduler for TYPO3 (4.7.7).</p>
  
  <p>In my task I need some URLs for records from tt_news. I tried to "boot" the frontend as did in "pxa_newstofb" extension but this does not work. Here is my current class that should generate a link to a news record:</p>
  
  <pre><code>&lt;?php
  
  abstract class tx_myextension_newshelper {
  
      /**
       * @var tslib_cObj
       */
      protected $cObj;
  
      function __construct() {
      }
  
      /**
       * Creates a URL for the given news
       *
       * @param $news
       * @return string
       */
      public function link($news) {
          // Init frontend
          $this-&gt;initTSFE($news['pid']);
  
          $newsLink = $this-&gt;cObj-&gt;typoLink_URL(array(
              'no_cache' =&gt; false,
              'parameter' =&gt; $news['pid'],
              'additionalParams' =&gt; '&amp;tx_ttnews[tt_news]=' . $news['uid'],
              'useCacheHash' =&gt; true
          ));
  
          if (substr($newsLink, 0, 7) != 'http://' || substr($newsLink, 0, 8) != 'https://') {
              $newsLink = $this-&gt;host($news) . $newsLink;
          }
  
          return $newsLink;
      }
  
      public function host($news) {
          return 'http://localhost/';
      }
  
      /**
       * Initialize frontend
       *
       * @param int $pageUid
       */
      public function initTSFE($pageUid = 1) {
  
          global $GLOBALS, $TSFE, $TYPO3_CONF_VARS;
  
          $this-&gt;cObj = t3lib_div::makeInstance('tslib_cObj');
          $temp_TTclassName = t3lib_div::makeInstance('t3lib_timeTrack');
          $GLOBALS['TT'] = new $temp_TTclassName();
          $GLOBALS['TT']-&gt;start();
  
          $TSFE = new tslib_fe($TYPO3_CONF_VARS, $pageUid, 0, 0);
          $TSFE-&gt;connectToDB();
          $TSFE-&gt;initFEuser();
          $TSFE-&gt;fetch_the_id();
          $TSFE-&gt;getPageAndRootline();
          $TSFE-&gt;initTemplate();
          $TSFE-&gt;forceTemplateParsing = 1;
          $TSFE-&gt;getConfigArray();
          $TSFE-&gt;initUserGroups();
          $TSFE-&gt;initTemplate();
          $TSFE-&gt;determineId();
  
          $GLOBALS['TSFE'] = $TSFE;
          $this-&gt;cObj-&gt;start(array(),'');
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>Everytime if I execute my task a "404" (frontend-)page without css will be shown. Is there a smart solution for creating frontend URLs for tt_news extension?</p>
  
  <p>System: Typo3 CMS 4.7.7 Introduction Package with RealURL.</p>