linkhandler extension (a christmas gift)
Did you also have costumers asking things like "How can I link to a news?" or "I want to link to products"...?
Well now you can answer this question easy with: "Of course linking to news is as easy as linking to a page.".
Extension linkhandler
This extension enables linking to any record by doing the following:
- adding Tabs to the link browser in the Backend
- enables typolink configuration to define how the links should be build for the frontend.
- comes with a patch for TYPO3 4.1.x
Using the linkhandler to link to tt_news:
- Be sure you have the requirements: TYPO3 >4.1 ; PHP 5
- download and install the extension
- If you run TYPO3 4.1.x you have to check the checkbox to activate the patch!
- Edit the TSConfig in the pageproperties of your rootpage.
- Edit the typoscript settings for your page.
- ..read the manual for details
Edit the TSConfig in the pageproperties of your rootpage:
The extension comes per default with a tab "News". So if you are fine with that - there is no need to adjust anything. However this is the default definition:
RTE.default.tx_linkhandler {
tt_news {
label=News
listTables=tt_news
}
}
mod.tx_linkhandler {
tt_news {
label=News
listTables=tt_news
}
}
Edit the typoscript settings for your page:
The extensio comes also with default typoscript configuration for tt_news. To load this you have to add the "linkhandler" static typoscript to your template.
Also you have to adjust the constant and set your single Pid.
linkhandler.newsSinglePid=**
By the way here is the default typoscript:
plugin.tx_linkhandler {
tt_news {
parameter={$linkhandler.newsSinglePid}
additionalParams=&tx_ttnews[tt_news]={field:uid}
additionalParams.insertData=1
useCacheHash=1
}
}
technical background
Since version 4.2 there is a new HOOK in the core - the first hook which is based on a PHP5 interface class. With the help of this hook you can add Tabs to the linkbrowser (both: the classic and the htmlarea RTE one).
The extension provides a way to define additional Tabs with TSConfig. The link to records are stored in the database in the format: record:<tablename>:<ui>
Since TYPO3 4.2 there is a new working feauture called linkhandler: An extension can register to handle links which begin with a certain key.
The extension linkhandler registers for the key "record" and therefore handles the building of links to records. The links itself are defined with a typolink object - with the trick that the typolink is loaded with the full datarow of the record.

