Announcement

Collapse
No announcement yet.

Getting a section name into a mailto subject line

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Getting a section name into a mailto subject line

    I've been trying to get a mailto to create an email with a section name in the subject line with this example...

    Code:
    <script language="javascript">
    <!--
    var contact = "click here"
    var email = "office"
    var emailName = "artinet"
    var emailTLD = ".co.uk"
    document.write("<a href=" + "mail" + "to:" + email + "@" + emailName + emailTLD + "?Subject=Enquiry%20about%20the%20<actinic:variable name="SectionName" />%20range" + ">"Click here to enquire about this range."</a>")
    //-->
    </script>
    The problem is that a lot of the section names have a space in them and so the subject line cuts off at that point, e.g. the subject line "Enquiry about the Golden Glow range" only gets as far as "Enquiry about the Golden" .

    Does anyone know of a way of replacing the spaces in section names with %20 in the script?

    Malcolm
    ¤ The world wide web needn't cost the earth
    ¤ ARTISAN INTERNET LTD
    ¤ www.artinet.co.uk

    #2
    What about using the page name variable instead?

    Army Gore-tex
    Winter Climbing Mitts
    webD's Blog: Website design, SEO and other ramblings…
    Twitter LinkedIN

    If you think a post is good, rate it!

    Find the answers in the Knowledge Base | Have you read the User Guides

    Comment


      #3
      Try using escape('<actinic:variable name="SectionName" encoding="perl" selectable="false"/>')

      This would need to be added as JavaScript.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Or <actinic:block php="true">echo rawurlencode('<actinic:variable name="SectionName" encoding="perl" selectable="false"/>');</actinic:block>

        This one would swap right in for the variable you were using.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          This might be cleanest as it save you typing those %20's.
          Code:
          document.write("<a href=" + "mail" + "to:" + email + "@" + emailName + emailTLD + "?Subject=<actinic:block php="true">echo rawurlencode('Enquiry about the <actinic:variable name="SectionName" encoding="perl" selectable=" false"/> range');</actinic:block>" + ">Click here to enquire about this range.</a>");
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            In the Immortal words of Darren "Whooooossshhhh"

            Nice one Norman, great response(s)

            Army Gore-tex
            Winter Climbing Mitts
            webD's Blog: Website design, SEO and other ramblings…
            Twitter LinkedIN

            If you think a post is good, rate it!

            Find the answers in the Knowledge Base | Have you read the User Guides

            Comment


              #7
              Thanks Norman and Rich, it appears from the page source that it will generate the full subject line, but the link's not appearing on the page because of an error...

              Line: 1393
              Char: 145
              Error: Expected ')'

              ... which is odd because both sets of nested brackets close in the relevant places and there are no other brackets in the script.

              I've even pasted in the original script from my OP and that's showing the same error now! (in Actinic as well as in IE).

              The full script is now...

              Code:
              <script language="javascript">
              <!--
              var contact = "click here"
              var email = "office"
              var emailName = "artinet"
              var emailTLD = ".co.uk"
              document.write("<a href=" + "mail" + "to:" + email + "@" + emailName + emailTLD + "?Subject=<actinic:block php="true">echo rawurlencode('Enquiry about the <actinic:variable name="SectionName" encoding="perl" selectable=" false"/> range');</actinic:block>" + ">"Click here to enquire about this range."</a>");
              //-->
              </script>
              Any ideas?

              Malcolm
              ¤ The world wide web needn't cost the earth
              ¤ ARTISAN INTERNET LTD
              ¤ www.artinet.co.uk

              Comment


                #8
                Could it be the "pasting" action that's causing issues here Norman?

                Have you tried pasting the code through notepad first?

                Army Gore-tex
                Winter Climbing Mitts
                webD's Blog: Website design, SEO and other ramblings…
                Twitter LinkedIN

                If you think a post is good, rate it!

                Find the answers in the Knowledge Base | Have you read the User Guides

                Comment


                  #9
                  Yes, I pasted into Notepad first, then into Actinic.

                  Malcolm
                  ¤ The world wide web needn't cost the earth
                  ¤ ARTISAN INTERNET LTD
                  ¤ www.artinet.co.uk

                  Comment


                    #10
                    This isn't really my strong point, sorry Malcolm. There doesn't seem to be anything obvious there. Try restarting Actinic.

                    Army Gore-tex
                    Winter Climbing Mitts
                    webD's Blog: Website design, SEO and other ramblings…
                    Twitter LinkedIN

                    If you think a post is good, rate it!

                    Find the answers in the Knowledge Base | Have you read the User Guides

                    Comment


                      #11
                      I've edited post 5. Try it again.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        Marvellous, what a star, many thanks Norman
                        ¤ The world wide web needn't cost the earth
                        ¤ ARTISAN INTERNET LTD
                        ¤ www.artinet.co.uk

                        Comment

                        Working...
                        X