Page 1 of 1

[SOLVED] "Mail this page"

Posted: Tue Jan 09, 2007 3:23 pm
by RonnyK
Next to the "print this page" on every page in the standard templates, I'd want to have a "mail this page"-option. I've seen it on a lot of pages, but not in CMSMS. Does anyone know how to insert this.

The "Print This Page" is done by calling a standard "TAG", but the similar "MAIL"-tag is missing.

Re: "Mail this page"

Posted: Tue Jan 09, 2007 3:45 pm
by cyberman
RonnyK wrote: Does anyone know how to insert this.
Have you read this  ;)

http://forum.cmsmadesimple.org/index.ph ... 827.0.html

Re: "Mail this page"

Posted: Tue Jan 09, 2007 8:29 pm
by RonnyK
I created the following code in a UDT called "rk-mail":
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}

echo '';
and called it in a page using

Code: Select all

{rk-mail}
this lead to the following error.
string(123) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag: rk-mail (Smarty_Compiler.class.php, line 439)" string(117) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 583)"
Someone any ideas??

Re: "Mail this page"

Posted: Tue Jan 09, 2007 8:35 pm
by Dee
Rename the tag to rk_mail and it should work...

Regards,
D

Re: "Mail this page"

Posted: Tue Jan 09, 2007 8:43 pm
by RonnyK
Thanks D,

taht did the trick. One question, why does it work using a "underscore" and not work using the "minus" in the name of the UDT. I often use my initials as a prefix before a code, in this case before mail, because if the tag "mail" is introduced in the core, my own UDT isn't in the way.

Ronny

Re: [SOLVED] "Mail this page"

Posted: Tue Jan 09, 2007 8:51 pm
by Dee
RonnyK wrote: why does it work using a "underscore" and not work using the "minus" in the name of the UDT
It can only contain letters, numbers and underscores.

http://smarty.php.net/manual/en/plugins ... ntions.php
http://www.php.net/language.variables

[edit]
Updated wiki.
[/edit]