TYPO3 6.2: How to render external Links differnt

170 Views Asked by At

I have a small problem with typoscript.

My Question is, is there the possibility to give all external links a separate css-class with typoscript in the front-end?

2

There are 2 best solutions below

0
On

As in my installations external links should open in a new window all external links are rendered with target="_blank" this could be used in CSS to change appearance:

a[target="_blank"],
a.link-external  { color:red, .... }

You can define the target used for external links (config.extTarget) but the handling is not done in typoscript. If you want a similar handling for CSS you need to do it at the same place.

0
On
    lib.mainNav = HMENU
    lib.mainNav {
        1 = TMENU
        1 {
            wrap = <ul class="nav navbar-nav">|</ul>
            NO = 1
            NO {
                wrapItemAndSub = <li class="f1">|</li> || <li class="f2">|</li> |*| <li class="m1">|</li> || <li class="m2">|</li> |*| <li class="l1">|</li> || <li class="l2">|</li>
                ATagTitle.field = title // subtitle
                ATagParams = calss="f" data-doktype="doktype_{field:doktype}"
                ATagParams.insertData = 1
                wrapItemAndSub.override.cObject = COA
                wrapItemAndSub.override.cObject {
                    if {
                        value = 3
                        equals.field = doktype
                    }
                    10 = TEXT
                    10.value = <li class="externLi">|</li>
                }

                ATagParams {
                    override.cObject = COA
                    override.cObject {
                        if {
                          value = 3
                          equals.field = doktype
                        }
                        10 = TEXT
                        10.value = calss="extern" data-doktype="doktype_{field:doktype}"

                        if {
                          value = 4
                          equals.field = doktype
                        }
                        10 = TEXT
                        10.value = calss="shortcut" data-doktype="doktype_{field:doktype}"
                    }
                }
                stdWrap.case = upper
            }
        }
    }