2

I have a page content element on a page. This has the ID 3 and it has a translation. This element is read out with the following Typoscript

lib.marker = RECORDS
lib.marker {
  tables=tt_content
    source= 3
    dontCheckPid = 1
  languageField = sys_language_uid
    select.languageField = sys_language_uid
}

For the default language everything is OK. But for my additional language I get

<a id="c605"></a>

before the div I originally wanted is displayed. I looked in the HTML of the page content and there is everything like it should be. Any ideas?

Edit:

Here the content gathered through the TS Object Browser:

[tt_content] = CASE
    [key]
    [stdWrap]
        [innerWrap]
        [innerWrap2] = | <p class="csc-linkToTop"><a href="#">{LLL...
        [prepend] = TEXT
            [dataWrap] = <a id="c{field:_LOCALIZED_UID}"></a>
            [if]
                [isTrue]
                    [field] = _LOCALIZED_UID
testing
  • 19,681
  • 50
  • 236
  • 417
  • Are you saying you don't want the anchor at all or that its ID has wrong value? – tmt Dec 07 '11 at 15:42
  • I don't want the anchor at all, because I have a stylesheet associated with that anchor and now the design is a little bit destroyed. The anchor shouldn't occur at all. – testing Dec 07 '11 at 15:52
  • See my edited answer on how to unset the anchor. However note that anchors are used when you link to a content element. Maybe it would be better to modify the anchor so that it has a CSS class so that you can make sure that it doesn't mess up your layout. – tmt Dec 07 '11 at 16:09
  • Currently I have taken the ID and set the CSS to `display:none`. But I wanted to know why this does occur (when it shouldn't). Also I didn't want to use my workaround (CSS). – testing Dec 07 '11 at 21:19
  • What shouldn't happen? The anchors "should occur" as they have very good purpose. See that when you create a link in the RTE, you can link directly to a content element. The page is then opened with the given content element at the top of the browser window. Anchors usually don't affect the layout in any way. I don't know how you modified the links and why it causes any problem in your case. – tmt Dec 09 '11 at 08:58
  • For everyone who is using TYPO3 v9 Here is the solution https://stackoverflow.com/questions/55899871/how-to-remove-anchors-in-a-multilang-typo3-9-5-5 – Harald Atteneder May 17 '19 at 13:58

3 Answers3

9

The default behaviour should be that the anchor is added even in the default language. However, I've just checked and realized that there might be a bug in TYPO3 for which reason I'm actually using different setup.

I think you have 2 options.

a) Unset the anchor completely:

tt_content.stdWrap.prepend >

b) Modify the anchor this way:

tt_content.stdWrap.prepend {
  if >
  dataWrap = <a id="c{field:_LOCALIZED_UID//field:uid}" class="anchor"></a>
}

This should give you an anchor consistently in both default and localized version. Then you should set CSS for a.anchor so that it doesn't screw your layout. I don't know what kind of layout problems it gives so I currently cannot give you more advice on that.

NOTE: The solution works in TYPO3 4.5, might work in later versions but is reported not to work in version 9.x.x and later.

tmt
  • 7,611
  • 4
  • 32
  • 46
  • No, it isn't added in the default language. Sorry, do you have a link how to use the Typoscript object browser? I currently don't know what it is and where I can find it. – testing Dec 07 '11 at 15:54
  • 2
    **Template** (in the left menu) then select **Typoscript Object Browser** from the select box. Your whole setup is there as a tree. Open nodes to explore the objects. – tmt Dec 07 '11 at 16:07
  • It seems that tt_content.stdWrap.prepend.dataWrap causes the problem. I think its a default behavior and shouldn't be changed? Or is my CSS the problem? (But the text element should be used and I cannot set a specific class directly). So should I stay with my workaround? – testing Dec 07 '11 at 21:27
  • See my edited answer. I would recommend going with the option b). – tmt Dec 09 '11 at 08:54
  • 1
    Thanks for sharing **b)**, very helpful snippet! – maryisdead Apr 14 '13 at 10:59
  • @ChristianMichael The answer is 7 years old and I'm afraid it might not be usable in current versions of TYPO3. I'll add a note about this to my answer. – tmt Apr 29 '19 at 08:57
1

I use following to get rid of unwanted anchor tag

tt_content.stdWrap.prepend >
tt_content.stdWrap.innerWrap.cObject.66.10 >
Mihir Bhatt
  • 3,019
  • 2
  • 37
  • 41
0

I used tt_content.stdWrap.prepend > to remove the anchors, but was still getting them.

Looking a tt_content, anchors are also prepended in to content elements with "no frame" (section_frame = 66).

This should get rid of them:

tt_content.stdWrap.innerWrap.cObject.66.10 >

(Typo3 v4.6)

Tim
  • 6,281
  • 3
  • 39
  • 49