A.Tietz
A.Tietz

Reputation: 77

typo3: mark link in sitemap with dateUntil

I have a problem with marking a link in a Stiemap with dateUntil. Here is my typoscript:

tt_content.menu.20.1 >
tt_content.menu.20.1 < tt_content.menu.20.7
tt_content.menu.20.1.1.wrap = <div class="menu_list_sitemap">|</div>
tt_content.menu.20.1.1.NO {
  ATagBeforeWrap = 0
  doNotLinkIt = 1
  stdWrap.htmlSpecialChars = 0
  stdWrap.cObject = COA
  stdWrap.cObject {
    # Untertitel verlinken
    10 = TEXT
    10 {
      field = subtitle
      wrap = |
      stdWrap.cObject = COA
      stdWrap.cObject {
        20 = IMAGE
        20.file.import.field = media
        20.file.import = uploads/media/
        20.file.import.listNum = 0
        20.wrap = |

        30 = TEXT        
        30.field = title
        30.wrap = <div class="txt">|</div>

        40 = TEXT
        40.if.isPositive.dataWrap = {field:newUntil}-{date:U}
        40.wrap = <div class="txt2">|</div>
        40.value = NEW
      }
      typolink.parameter.field = uid
    }
  }
}  

The result is, that the new entries will get an additional div-container with class="txt2". Wokrs fine so far. :-) Here the generated HTML:

<li>
    <a href="link-to-my-page">
        <img width="22" height="22" alt="" src="my-image.png">
        <div class="txt">My-Text</div>
        <div class="txt2">NEW</div>
    </a>
</li>  

But now I need to add a "class='new'" to the Link or optional to a surrounding div-container (not my idea, really). I tried now for some hours to find a solution, but nothing worked.
Any suggestions?

Upvotes: 0

Views: 203

Answers (1)

maholtz
maholtz

Reputation: 3631

i guess ATagParams would do the job. Use if to add only if needed

tt_content.menu.20.1 >
tt_content.menu.20.1 < tt_content.menu.20.7
tt_content.menu.20.1.1.wrap = <div class="menu_list_sitemap">|</div>
tt_content.menu.20.1.1.NO {
  ATagBeforeWrap = 0
  doNotLinkIt = 1
  stdWrap.htmlSpecialChars = 0
  stdWrap.cObject = COA
  stdWrap.cObject {
    # Untertitel verlinken
    10 = TEXT
    10 {
      field = subtitle
      wrap = |
      ### snip ###
      typolink.parameter.field = uid
      typolink.ATagParams = class="new"
      typolink.ATagParams.if.isPositive.dataWrap = {field:newUntil}-{date:U}
    }
  }
}  

Upvotes: 1

Related Questions