typo3typoscriptimagemaptypo3-6.1.xtypolink

How to embed imagemap HTML in TYPO3 with typolink / realURL functionality?


The context:

I need to insert an imagemap into a page in TYPO3 6.1.

As EXT:imagemap_wizard is not working currently in 6.1, I can create the imagemap offline and then insert it via the HTML content type.

The question:

It would be nice to be able to just write the internal URLs in the HTML, but output realURLs. Can the "HTML" type field be passed through the parser that renders URLs?

So that

<area shape="rect" href="index.php?id=55" coords="6,153,189,231" alt="">

would be rendered as

<area shape="rect" href="/my/realurl/" coords="6,153,189,231" alt="">

Or is there another way? Maybe put the HTML into a fluid template and tell it to render any URL it finds in the template?


Solution

  • The simple approach with parseFunc_RTE does not work, because we need to act on the attribut. So, this code is tested with css_styled_content TYPO3 6.1. So, just use the tags function:

    # we parse the HTML, but we only focus on tag *area*
    # i created an COA, because IMHO it is easier to maintain.
    # i guess, it would be possible in a few lines only, but i did not tested that
    tt_content.html.parseFunc.tags.area = COA
    tt_content.html.parseFunc.tags.area {
     wrap = <area |/>
     20 = TEXT
     # all attributs are loaded into parameters array
     20.data = parameters:shape
     20.noTrimWrap = | shape="|" |
     30 = TEXT
     30.typolink.parameter.data = parameters:href
     # we only need the URL, not the full link
     30.typolink.returnLast = url
     30.noTrimWrap = | href="|" |
     40 = TEXT
     40.data = parameters:coords
     40.noTrimWrap = | coords="|" |
     50 = TEXT
     50.data = parameters:alt
     50.noTrimWrap = | alt="|" |
    }
    
    # for testcase, create TS-Template with css_styled_content included
    # and create html-record on that page in column 0
    page = PAGE
    page.10 < styles.content.get