[TYPO3-content-rendering] Valid anchor links
Christian Trabold
trabold at mehrwert.de
Mon Aug 8 16:03:46 CEST 2005
Hi Sacha,
Hi Andreas,
> the menu is not a problem, but for the RTE links you need a little code:
>
> # all content element anchors get a prefix for the name and id attribute
> tt_content.stdWrap.dataWrap = <a name="content{field:uid}"
> id="content{field:uid}"></a>|
> # the section menu is adapted
> tt_content.menu.20.3.renderObj.typolink.section.wrap = content|
> # reference to a php function
> includeLibs.xhtmlanchor = fileadmin/user_typolink.inc
> tt_content.text.20.parseFunc.tags.link.typolink.parameter.postUserFunc =
> user_xhtmlAnchor
>
> example for the fileadmin/user_typolink.inc:
> <?php
> function user_xhtmlAnchor($content,$conf) {
> $uriparts = explode('#',$content);
> if (isset($uriparts['1'])) {
> $content = $uriparts['0'].'#content'.$uriparts['1'];
> }
> return $content;
> }
> ?>
I encountered an "issue" with tt_content.menu.20.7 because I could not
find a way of getting the menu items processed with postUserFunc.
So I implemented a small IProcFunc here:
/**
Fix local anchors in menus (menu.20.7)
*/
function user_menu_xhtmlAnchor($I, $conf) {
$I['linkHREF']['HREF'] =
$this->user_xhtmlAnchor($I['linkHREF']['HREF'], $conf);
$conf['parentObj']->I = $I;
$conf['parentObj']->setATagParts();
$I = $conf['parentObj']->I;
$I['parts']['ATag_begin'] = $I['A1'];
return $I;
}
Is there a nicer way of doing this?
Regards,
Christian
More information about the TYPO3-project-content-rendering
mailing list