[TYPO3] Re: [Typo3] External URL in menu

Claudio Strizzolo claudio.strizzolo at ts.nogarb.ageinfn.it
Mon Jun 23 13:52:52 CEST 2008


Just in case someone is interested, this is a way to define external URLs 
in a menu with the following features:

- links to external URLs point directly to the target address, without
  passing through an internal Typo3 page of type "External URL";
- an icon is displayed to identify external links;
- http/https addresses are supported.

Here it is:

(...)
NO {
  # We'll handle the doktype=3 (external URL) as a special case. 
  # Other doktypes are handled as a default
  stdWrap.cObject = CASE
  stdWrap.cObject {
    key.field = doktype
    default = TEXT
    default.field = title
    default.typolink.parameter.data = field:uid
    default.typolink.ATagBeforeWrap=1
    default.typolink.wrap=|
       
    # Handle external URLs here (doktype=3). 
    # In order to handle the different values allowed for
    # the urltype field (http/https/ftp/...), a text block is 
    # defined for each of them. In this example only http and 
    # https are taken into consideration.
    # The complete list of allowed values for urltype is:
    #
    #    0=''
    #    1='http://'
    #    2='ftp://'
    #    3='mailto:'
    #    4='https://'
    3=COA
    3 {
      # Basic text block. Used for http
      10 = TEXT
      10 {
        field = nav_title//title
        typolink.parameter.data >
        typolink.parameter.dataWrap = http://{field:url}
        typolink.ATagBeforeWrap=1
        typolink.wrap = |
        typolink.wrap = <span class="menusx-l2-extlink">|</span><span 
class="menusx-l2-extimg"><img src="/somewhere/external.png" alt="External 
link" width="10" height="10" /></span>
        stdWrap.htmlSpecialChars = 1
        if {
          value=1
          equals.field=urltype
        }
      }
      
      # Text block for https. Let's copy it from above and
      # change just what is needed.      
      20 = TEXT
      20 < .10
      20 {
        typolink.parameter.dataWrap = https://{field:url}
        if {
          value=4
          equals.field=urltype
        }
      }                 
    }  
          
  }
  doNotLinkIt = 1     # to avoid "<a>" repeated twice
  subst_elementUid = 1
  wrapItemAndSub = <li class="menusx-l2-no">|</li>
}
(...)

Claudio


More information about the TYPO3-english mailing list