Menü schliessen
Created: February 27th 2012
Last updated: May 1st 2020
Categories: Typo3
Author: Marcus Fleuti

Typo3 realurl plugin :: When using the page type -link to external url- the external URL (link) shall be shown (instead of the internal URL pointing to a virtual page)

Tags:  Typo3
Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

The Problem

When using the Typo3 extension 'RealURL' and a page with the type "link to external URL" is being created the URL is being encoded to an internal page URL by RealURL.

The Solution

This behaviour can be changed in the RealURLs source code.
1. Edit the file

typo3conf/ext/realurl/class.tx_realurl.php

2. Add the following lines at the end of the function encodeSpURL(&$params)

// --> After this line
// Setting the encoded URL in the LD key of the params array - that value is passed by reference and thus returned to the linkData function!
// --> Add this code:

if($params['args']['page']['doktype'] == 3 && $params['args']['page']['url']){
 switch($params['args']['page']['urltype']){
 case 0:
 $preUrl = '';
 break;
 case 1:
 $preUrl = 'http://';
 break;
 case 2:
 $preUrl = 'ftp://';
 break;
 case 3:
 $preUrl = 'mailto:';
 break;
 case 4:
 $preUrl = 'https://';
 break;
 }
 $newUrl = $preUrl.$params['args']['page']['url'];
}

// --> end of new code
$params['LD']['totalURL'] = $newUrl;

Opening such links in new window (target="_blank")

This is pretty easy:

  1. Edit the desired page
  2. Choose the tab "behaviour"
  3. Enter "_blank" (without quotes) into the "Link Target" field area like this:

The downside

Using this solution updating the RealURL plugin would mean that the above changes will be reverted. For a more solid solution you would have to write your own extension that changes RealURLs' behaviour. This is not part of this tutorial.

Disclaimer

The above information was found in the typo3 forum: http://www.typo3.net/forum/beitraege/thema/58865/?page=1