2 Replies Latest reply on Mar 22, 2017 4:17 PM by Grégoire Michel

    Velocity: " makes a reference treated as a literal in an <a> tag

    Grégoire Michel

      Hi all,

       

      I am using the following code:

       

      #set($downloadLink={

        "BPDCS":{

        "title":"BPD Case Study",

        "link":"http://infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-bpd-digitalisation-marketing-systeme-information-marketing-commercial.pdf"

        },

        "DACS":{

        "title":"Deny All Case Study",

        "link":"http://infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-denyall-marketing-automation.pdf"

        },

          "IVCS":{

        "title":"Infovista Case Study",

        "link":"http://infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-infovista-systeme-information-marketing.pdf"

        },

        "EBSCS":{

        "title":"ESSEC Case Study",

        "link":"http://infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-essec-conception-deploiement-strategie-acquisition-nurturing.pdf"

        },

        "KDSCS":{

        "title":"KDS Case Study",

        "link":"http://infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-kds-nouvelles-pratiques-generation-demande-automatisee.pdf"

        }

      })

      <ul>

      #foreach ($key in $lead.downloadcenter.split("[;]"))

      #set ($key = ${key.trim()})

            <li><a href="${downloadLink.get($key).link}" target="_blank" class="mktNoTrack">$downloadLink.get($key).title</a> : $downloadLink.get($key).link</li>

      #end

      </ul>

       

      The second call to $downloadLink.get($key).link displays the URL OK. But the first one in the href returns an error when we click the link.

       

      For those who want to see it working, try this form: inficiences

       

      Any help is welcome

       

      -Greg

        • Re: Velocity: " makes a reference treated as a literal in an <a> tag
          Sanford Whiteman

          It's not really a reference-as-literal. But it is a bug (not in Velocity but in the way Marketo post-processes VTL output).

           

          Do you see the same when you strip the http:// from the URL and hard-code it in the <a href=> (as we would outside of Velo)?

          1 of 1 people found this helpful
            • Re: Velocity: " makes a reference treated as a literal in an <a> tag
              Grégoire Michel

              Hi Sanford,

               

              Thx this is working.

               

              For a reference, the right code is:

               

              #set($downloadLink={

                "BPDCS":{

                "title":"BPD Case Study",

                "link":"infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-bpd-digitalisation-marketing-systeme-information-marketing-commercial.pdf"

                },

                "DACS":{

                "title":"Deny All Case Study",

                "link":"infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-denyall-marketing-automation.pdf"

                },

                  "IVCS":{

                "title":"Infovista Case Study",

                "link":"infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-infovista-systeme-information-marketing.pdf"

                },

                "EBSCS":{

                "title":"ESSEC Case Study",

                "link":"infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-essec-conception-deploiement-strategie-acquisition-nurturing.pdf"

                },

                "KDSCS":{

                "title":"KDS Case Study",

                "link":"infos.inficiences.com/rs/593-IYJ-660/images/Inficiencespartners-casestudy-kds-nouvelles-pratiques-generation-demande-automatisee.pdf"

                }

              })

              <ul>

              #foreach ($key in $lead.downloadcenter.split("[;]"))

              #set ($key = ${key.trim()})

                    <li><a href="http://${downloadLink.get($key).link}" target="_blank" class="mktNoTrack">$downloadLink.get($key).title</a> : $downloadLink.get($key).link</li>

              #end

              </ul>

               

              Useful to be used for a download center together with a unique field displayed in forms as a checkboxes.

               

              -Greg