Hi, I am trying to output the [[*pagetitle]] and [[~[[* id]]? &scheme= full ]] of a resource such that it is compliant for use in a mailto link. htmlentities output modifier doesn’t seem to work for this purpose. Example:
To: <a href="mailto:[email protected]?subject=How%20to%20get%20an%20A+%20in%20Weight%20Loss&body=%3Ca%20href%3D%22https%3A//www.domain.com/a-in-weight-%0Aloss%22%3Ehttps%3A//www.domaincom/a-in-weight-loss%3C/a%3E">your message here</a>
Is there an existing output modifier I’m not seeing in the documentation, or would I have to write a snippet/modifier from scratch? I don’t know PHP (real programming goes over my head), how would I go about that if I need to?
Use the URI of the resource instead of [[~]] perhaps. Something like
<a href="mailto:[[*uri:htmlent]]">[[*uri]]</a>
And even if you did have to use PHP, this one would be quite easy. Just create a snippet called “htmlent” or whatever you want.
Then call it and pass in the URL you have like [[htmlent? &url=`[[~[[*id]]]]`]]
Actually urlencode doesn’t do what I need it to. I get + instead of %20 for spaces, so I end up with no content in the subject line of an email as a result. I this is the result of differences between rawurlencode() and urlencode() in php. Either way, the snippet does what I need it to, so problem solved. Thanks!