by
Solaris » Sun Jun 17, 2012 8:22 am
@cheesypoof, @KK:
I must admit that, in spite of your kind help, it took me a huge amount of trial and error to find the correct way of implementing some of the methods hinted at above.
Once you've got the hang of it, it seems so terribly easy, but without any complete examples of how to combine and, above all, where exactly to place these little code snippets, it's extremely time consuming for the beginner.
Thanks to your help and with a lot of trial and error I managed to implement the 2 solutions where a fixed mail address is included and 1 solution to include the antispam script as required in my OP.
What I still haven't achieved is to do what KK suggested in his first reply above, i.e.
KK wrote: You can use an editable region of type 'text' for the client to input his email address and then while displaying back the value, cloak it using 'cloak_email'
e.g
- Code: Select all
<cms:cloak_email my_email />
where 'my_email' ihe editable region containg plain-text email address.
Problem is I still don't know how to combine the editable region and the cloak:tag (nor the show:tag, BTW), which is mentioned several times in the tutorials, but never shown as a complete thing.
Here is what I tried:
(1) no success
- Code: Select all
<p><cms:editable name='my_email' label='Mail Address' desc='Enter mail address here, please!' hidden='1' no_xss_check='1' type='text' />
E-Mail: <cms:cloak_email my_email /></p>
(2) no success
- Code: Select all
<p><cms:editable name='my_email' label='Mail Address' desc='Please change mail address here, if necessary' hidden='1' no_xss_check='1' type='text'>here I put my mail address</cms:editable>
E-Mail: <cms:cloak_email my_email /></p>
(3) only partial success
(3a)
- Code: Select all
<p>E-Mail: <cms:do_shortcodes><cms:editable name='my_mail_address' type='text'>[mailto]here I put my mail address[/mailto]</cms:editable></cms:do_shortcodes></p>
(3b)
used above code in combination with file called kfunctions.php in root:
- Code: Select all
<?php
// Obfuscate email
// Usage: [mailto]email@mydomain.com[/mailto]
$FUNCS->register_shortcode( 'mailto', 'mailto_handler' );
function mailto_handler( $params, $content=null ){
global $FUNCS;
// Create Couch script.. we'll use the 'cloak_email' tag to encrypt email
$html = "<cms:cloak_email email='{$content}' />";
// Pass on the code to Couch for execution using the 'embed' function
return $FUNCS->embed( $html, $is_code=1 );
}
Trial #3 seemed to work at first sight, displaying an editable region of the text type in the admin panel with my mail address already included, and the correct address on the web page.
B U T:
After changing the mail address in the admin panel and clicking on the "save" button, the mail address doesn't change accordingly on the web page, but now there appears the obfuscated mail code instead of the changed mail address.
Further help will be very much appreciated!
Thanks
Solaris