Here's an one that's had me stuck for a while now:
I have an email TV which I'm passing as a snippet parameter. The snippet retrieves and can print out the email address just fine, but for some reason if I look for the @ sign, using anything like strpos() or even explode($email, '@'), it finds nothing and spits out nothing in the case of the former and the full string in one chunk in the case of the latter.
If someone can shed light on how this confirmed string might otherwise have encoded the @ sign, I'd appreciate it!
I believe I also tried a basic text TV, with no success.
Thanks.
Can you paste the code (both the snippet tag and the snippet)?
---------------------------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
MODX info for everyone:
http://bobsguides.com/modx.html
The [[+email]] placeholder tag hasn't been processed at the time the snippet runs, so you're actually passing the tag rather than the email address in the property. When you echo the variable, you're actually echoing the [[+email]] tag, which appears to work because the that tag is later processed to display the email address.
As an aside, most good email forms like SPForm and FormIt don't obfuscate email addresses, they don't display them but rather look them up or get them from the properties array.
---------------------------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
MODX info for everyone:
http://bobsguides.com/modx.html
Ok, thanks for the explanation - makes good sense.
In that case, perhaps if I explain my intention you could suggest a workaround. I write a simple snippet for the sole purpose of cutting an email address string into parts, in order to print them on the screen amongst a prepared javascript... script, the purpose of which is to essentially hide the email address from bots by preventing it appearing in plain text.
I suppose the significance here is that the email address isn't being captured from users, but instead it being entered as content in the manager, requiring a snippet call.
As I type this I'm thinking I should probably rework my snippet as an output filter. I presume output filters work differently and therefore the value of the placeholder will be available to my snippet as planned. In which case, my next question is: can you pass additional parameters to a snipper being used as an output filter? My research into the subject so far hasn't made that very clear.
Thanks again for you help.
[EDIT:] It appears in the documentation that you can give the output modifier snippet one value in backticks, which is then made available in the snippet as "options" - plural. Does that imply you can indeed send more than one value, and if so, what's the syntax?
Using this method I no longer need to pass the email address as a parameter because it's the subject, but to build an email link I might want to allow the snippet to present custom anchor text, so I'd need an optional parameter.
[ed. note: davidsmith last edited this post 14 years, 6 months ago.]
Yes, you can definitely pass parameters to an output modifier, but I wonder if a plugin attached to OnParseDocument (before tags are processed) or OnWebPagePrerender (after tags are processed) wouldn't be a better route. Then users wouldn't have to remember to add the modifier.
You could search for email addresses with preg_match, modify them, and then do a search and replace.
FYI, I think there may already be some email obfuscation extras for Revolution. I know there are for Evolution. There's a good chance that the Evo ones would work in Revo with little or no modification.
http://modx.com/extras/package/emoemailobfuscation
http://modx.com/extras/package/emaillinkobfuscator
---------------------------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
MODX info for everyone:
http://bobsguides.com/modx.html
Ah. Well. That's a much better plan. And it sounds like the work's been done for me! Thanks very much, yet again - most helpful.
Beats me.