Send a friend

FIXME translate images (KH)

Send a friend PopUp.
Have a look http://www.iba-stadtumbau.de/index.php?news-aktuell (Letter down stares beside the printer symbol).

Docu: –
Forum: Tell a friend

Autor: Oliver Georgi http://phpwcms.de/ treated: K.Heermann (flip-flop) (05.05.09)
CMS-Version: >= V1.2.8
Version: V1.0 05.05.08

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_render'] = 1;


Features:

  • eMail adress recipient
  • eMail-adress sender
  • name from sender
  • anti-spam protection
  • message



TAG (FE)

Place in layout where the form is to appear:

{SHOW_CONTENT:CPA,16}

16 is the ID of the article where the form is located.

The activation of the form (Click → on/off):

<span class="sendafriend_button">
<a title="Seite Weiterempfehlen" id="safbutton" class="sendafriend" href="#jumpForm17"><span>Weiterempfehlen</span></a>
</span>

#jumpForm17 is result from #jumpFormCP-ID=17


PHP

Fileiname: rt_sendafriend.php

Location: /template/inc_script/frontend_render/

rt_sendafriend.php

<?php
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ----------------------------------------------------------------
 
$block['custom_htmlhead']['mootools.js']  = '  <script src="'.TEMPLATE_PATH.'inc_js/mootools/mootools.js" type="text/javascript"></script>';
// Send a Friend
$block['custom_htmlhead']['sendafriend.js']    = '  <script src="'.TEMPLATE_PATH.'inc_js/mootools/tools/sendafriend.js" type="text/javascript"></script>';
 
?>


CSS

Fileiname: sendafriend.css

Location: /template/inc_css/

sendafriend.css

/* Send a friend */
#content div.sendafriend {
    border: 1px solid #D8DBDB;
    border-right-color: #B1B8B7;
    border-bottom-color: #B1B8B7;
    background: #F9F9F9;
    padding: 5px 0 5px 0;
    margin: 20px 10px 0 0;
    line-height: 100%;
    clear: left;
}
#content div.sendafriend h3 {
    font-size: 1.8em;
    color: #A5ADA5;
    font-family:  Arial, Helvetica, sans-serif;
    font-weight: normal;
    height: 35px;
    line-height: 28px;
    padding: 0 5px 10px 10px;
}
#content div.sendafriend form {
    padding: 0 10px 0 10px;
    margin: 0;
}
#content div.sendafriend form p {
    padding: 0 0 6px 0;
    margin: 0;
}
#content div.sendafriend form p em {
    display: block;
    font-size: .9em;
    padding: 0 0 1px 0;
    margin: 0;
    color: #686C71;
    font-style: italic;
}
#content div.sendafriend div.notice {
    padding-left: 280px;
}
#content div.sendafriend div.fields {
    float: left;
}
#content div.sendafriend form textarea.text {
    width: 375px;
    height: 130px;
    font-size: 1em;
}
#content div.sendafriend form input.text {
    width: 260px;
    font-size: 1em;
}
#content div.sendafriend form input.button {
    width: auto;
    font-size: 1em;
    font-weight: bold;
    margin-top: 6px;
}
#content div.sendafriend p.notice {
    font-size: .9em;
    padding: 10px 12px 5px 12px;
    margin: 0;
    color: #686C71;
    font-style: italic;
    clear: left;
    line-height: 125%;
}
#content div.sendafriend p.error {
    padding: 0 12px 10px 10px;
    margin: 0;
    color: #CC3300;
    line-height: 125%;
    font-weight: bold;
}
#content div.sendafriend p.success {
    padding: 0 12px 0 10px;
    margin: 0;
    color: #5BAC26;
    line-height: 125%;
    font-weight: bold;
}
 
 
 
/* FOOTER -------- */
#footer span.sendafriend_button {
    width: 200px;
    height: 16px;
}
 
#footer a.sendafriend {
/*    float: left; */
    width: 15px;  /* width: 15px; */
    height: 16px;
    padding: 0;
    margin: 0 0 0 4px;
    overflow: hidden;
    background-position: left 2px;
    background-repeat: no-repeat;
}
 
 
#footer a.sendafriend {
    background-image: url(../../img/famfamfam/group.gif);
    margin-left: 5px;
}
 
#footer a.sendafriend:hover {
    background-image: url(../../img/famfamfam/group_add.gif);
}
 
#footer a.sendafriend span {
/*    float: left; */
    width: 0;
    height: 0;
    margin-left: 18px;
}


JavaScript

Filename: sendafriend.js

Location: /template/inc_js/mootools/tools/

sendafriend.js

window.addEvent('domready', function() {
 
    var sendafriend = $('sendafriend');
    if(sendafriend) {
 
        // do not hide send-a-friend form
        if( $('safsuccess') || $('saferror') ) {
 
            var sendafriend_status = true;
 
        } else {
 
            var sendafriend_status = false;
            sendafriend.setStyle('display', 'none');
 
        }
 
        $('safbutton').addEvent('click', function(r) {
 
            if(sendafriend_status == true) {
 
                sendafriend.setStyle('display', 'none');
                sendafriend_status = false;
 
            } else {
 
                sendafriend.setStyle('display', '');
                sendafriend_status = true;
 
            }
 
        });
 
    }
});


Recommended: The form is not automatically visible if JS is turned off.

sendafriend.js (if the form is poped up a short time during site load)

window.addEvent('domready', function() {
 
    var sendafriend = $('sendafriend');
    if(sendafriend) {
 
        // do not hide send-a-friend form
//        if( $('safsuccess') || $('saferror') ) {
        if( $('safsuccess') || $('saferror') || $('safok') ) {  // +KH: id safok used in "on success"
 
            sendafriend.setStyle('display', '');                // +KH: if the form pops up during site load
            var sendafriend_status = true;
 
        } else {
 
            var sendafriend_status = false;
            sendafriend.setStyle('display', 'none');
 
        }
 
        $('safbutton').addEvent('click', function(r) {
 
            if(sendafriend_status == true) {
 
                sendafriend.setStyle('display', 'none');
                sendafriend_status = false;
 
            } else {
 
                sendafriend.setStyle('display', '');
                sendafriend_status = true;
 
            }
 
        });
 
    }
});


Article


First HTML CP:

    <div id="sendafriend" class="sendafriend" style="">

Recommended:
First HTML CP: (if the form pops up a short time during site loading)

    <div id="sendafriend" class="sendafriend" style="display:none">


Form

on success

The recommendation has been sent successfully.

Recommended:
(switch on success to [X] HTML)

on success, if a "Close form"-link is desired

<p id="safok">The recommendation has been sent successfully.</p><br />
[PHP]
echo '<a href="index.php?'.$GLOBALS['content']['struct'][$GLOBALS['content']['cat_id']]['acat_alias'].'">Close form</a>';
[/PHP]

The “Close form”-link has the advantage that the page is reloaded without an anchor and a new form input is immediately possible.

on error

<p class="error" id="saferror">Your request could not be sent! <br />
Please fill or correct the color-highlighted areas.</p>

recipient - template

Der Absender {yourname}
{sender}
recommends you the link to the following page:
{FORM_URL}
 
------------------------------------------------------------------------
{message}
------------------------------------------------------------------------
 
We point out that the return address is not verified.
 
If you have doubts about the authenticity of the sender,
just ignore this e-mail please.

Recommended:

template, if a "Close form"-link is desired (insert at the end)

.........
<br />
<a href="index.php?{CATEGORY_ALIAS}">Close form</a>

(presupposes: Standard tags assembled)


Law related stuff

<note important>The legal situation with “Send-a-friend”- offers seems to be quite unclear (at least in germany) at this time. Take it for sure that sending your site's address along with some additional advertising will directly lead you into some illegal situation. Some courts claim that sending a pure site address is already offending while others overturn these conviction.
Relief: write an adequate disclaimer, eliminate the text input field, make use of the captcha function and watch out for upcoming court decisions
All at least germany- related (note: this is no legal advice)</note>

english/phpwcms-system/article/contentparts/form/special-applications/send-a-friend.txt · Last modified: 2018/06/03 18:09 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0