[TYPO3-dev] Create correct (typo-) links in extension?

Gerhard Mehsel sparking at gmx.net
Sun Dec 13 14:53:01 CET 2009


Hello,

I've a small extension (TYPO3 4.2.10) where a BE User can input some 
links. These input fields for the links are standard input fields from 
extension kickstarter of type 'link'.
These links can be internal (PID) or external URLs.
What is the best way to create these links in my extension?
Currently I do it this way:

$linkTxt = 'Here I want to have the page title, not the PID';
$pid = 123;
$cObj = t3lib_div::makeInstance('tslib_cObj');
$conf = array('parameter'=> $pid);
return $cObj->getTypoLink($linkTxt, $conf);

it's working of course, but the links are not formatted nicely. E.g. 
internal links: the pid of the page is wrapped by the a-tags, not the 
page title. Also external links should display the 'title'-input field 
form the link-popup instead of the URL.

How do you do this? Do I have to query the DB to get information like 
title of a page? I also read the documentation about typolink, but I 
don't get the point. Would be great if anybody could give me a link to 
some sample code for an entry point.

Thank you for hints,
Gerd






More information about the TYPO3-dev mailing list