ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Email Links

June 17, 2011 5:29am

Subscribe [4]
  • #1 / Jun 17, 2011 5:29am

    Evolve Websites

    110 posts

    Hi there,

    I’m trying to create content managed email links.

    I’ve got a matrix containing Staff name, job title, thumbnail, bio and an email link.

    I’ve used the following code in my template:

    {encode="{email}" title="> click here to email {name}"}

    But when I view the site, it’s giving me the following:

    <span>.(JavaScript must be enabled to view this email address)</span>[removed]/*<![CDATA[*/var l=new Array();var output = ;l[0]=>;l[1]=a;l[2]=/;l[3]=<;l[4]= 109;l[5]= 111;l[6]= 99;l[7]= 46;l[8]= 101;l[9]= 116;l[10]= 97;l[11]= 101;l[12]= 114;l[13]= 99;l[14]= 45;l[15]= 98;l[16]= 114;l[17]= 64;l[18]= 100;l[19]= 114;l[20]= 97;l[21]= 104;l[22]= 99;l[23]= 105;l[24]= 114;l[25]=>;l[26]=\;l[27]= 109;l[28]= 111;l[29]= 99;l[30]= 46;l[31]= 101;l[32]= 116;l[33]= 97;l[34]= 101;l[35]= 114;l[36]= 99;l[37]= 45;l[38]= 98;l[39]= 114;l[40]= 64;l[41]= 100;l[42]= 114;l[43]= 97;l[44]= 104;l[45]= 99;l[46]= 105;l[47]= 114;l[48]=:;l[49]=o;l[50]=t;l[51]=l;l[52]=i;l[53]=a;l[54]=m;l[55]=\;l[56]==;l[57]=f;l[58]=e;l[59]=r;l[60]=h;l[61]=a ;l[62]=<;for (var i = l.length-1; i >= 0; i=i-1){ if (l[i].substring(0, 1) == ) output += &#+unescape(l[i].substring(1))+;; else output += unescape(l[i]);document.getElementById('eeEncEmail_MMxcBSzorI')[removed] = output;/*]]>*/" title="> click here to email Richard Blake"}

    Any ideas?

    If there’s a better way to display email addresses that can be edited from the back-end, please let me know.

    Thanks in advance,

    Tom

  • #2 / Jun 17, 2011 5:06pm

    Sue Crocker

    26054 posts

    Hi, Tom.

    Are you testing without Javascript turned on?

    If you try this example from the docs, does that work?

    http://ellislab.com/expressionengine/user-guide/templates/globals/single_variables.html#var_encode

  • #3 / Jun 20, 2011 8:08am

    Evolve Websites

    110 posts

    Hi Sue,

    If I use the encode tag it works perfectly, but this means hard-coding the email address into the template.

    What I’d like to do is to allow the client to edit this email address if required.

    I’ve setup a fields within a matrix for {name} and for {email}.

    I’ve then entered the following code in my template:

    {encode="{email}" title="> click here to email {name}"}

    But this gives me the error quoted above.

    Surely it’s possible to enter an email address in the back end within an entry and display this on the front-end?

  • #4 / Jun 20, 2011 10:05am

    Sue Crocker

    26054 posts

    When you say matrix, do you mean the third party add-on Matrix, or do you mean custom fields?

  • #5 / Jun 20, 2011 10:32am

    Evolve Websites

    110 posts

    I mean the third party matrix. If that’s a problem, please ignore that and let me know how to do this anyway?

  • #6 / Jun 21, 2011 8:21am

    John Henry Donovan

    12339 posts

    Tom,

    In your Channel Management preferences under Channel Posting Preferences do you have Automatically turn URLs and email addresses into links? turned off?

  • #7 / Jun 21, 2011 10:38am

    Evolve Websites

    110 posts

    BINGO!

    John, you’re a star, thanks!

  • #8 / Jun 21, 2011 11:52am

    Kyle Cotter

    730 posts

    Hey Tom,

    Glad John was able to help out! Feel free to post again as needed.

    Thanks!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases