Forums / General / Send to Friend in 3.x?

Send to Friend in 3.x?

Author Message

Josh Sowin

Wednesday 24 March 2004 8:39:08 am

Does anyone know if there is a "send to friend" module or extention (or built in!)? I would really like this feature and it seems like it would be included in a CMS. I already have a ezPublish 3.3 installation that is live but I would love to a send to friend and an e-card module from ezpublish.

Any suggestions on how to go about this? Thanks!

Georg Franz

Wednesday 24 March 2004 9:06:15 am

Hi,

yes, it's implemented.

It's reachable at
/content/tipafriend/{$node.node_id}

If you want to enable it on every page, just put following code in your pagelayout.tpl:

{cache-block keys=array("tip_a_friend",$uri_string) expiry=86400}
	{section show=and(is_set($DesignKeys:used.node),ne($site.uri.tail,''))}
		<p align="center">
			<a href={concat("content/tipafriend/",$DesignKeys:used.node,"/")|ezurl}>Tip a friend</a>
		</p>
	{/section}
{/cache-block}

Another tip:

Be aware, the 1st page of the "tip a friend" will not be cached. So e.g. if you alter the design/yourdesign/override/templates/content/tipafriend.tpl and you want to show the "short version" of the current node, you can add e.g.

(* This shows the "line"-version of the current node *)
{let tip=fetch(content,node,hash(node_id,$node_id))}
{node_view_gui view=line content_node=$tip}
{/let}

The viewing of the 1st "tipafriend" page will be slow.

To prevent this, create a new "view mode" and call it "tipafriend".

Place a "tipafriend.tpl" in
design/yourdesign/override/templates/node/view

An example template code for the new "view mode":

<div class="maincontentheader">
<h1>Tip a friend</h1>
</div>

{node_view_gui view=line content_node=$node}

<form name="tipafriend" action={"content/tipafriend/"|ezurl} method="post">
<div class="block">
<label>{"Your name"|i18n("design/standard/content/tipafriend")}</label><div class="labelbreak"></div>
<input class="box" type="text" size="40" name="YourName" value="" />
</div>

<div class="block">
<label>{"Your email address"|i18n("design/standard/content/tipafriend")}</label><div class="labelbreak"></div>
<input class="box" type="text" size="40" name="YourEmail" value="" />
</div>

<br/>

<div class="block">
<label>{"Receivers name"|i18n("design/standard/content/tipafriend")}</label><div class="labelbreak"></div>
<input class="box" type="text" size="40" name="ReceiversName" value="" />
</div>

<div class="block">
<label>{"Receivers email address"|i18n("design/standard/content/tipafriend")}</label><div class="labelbreak"></div>
<input class="box" type="text" size="40" name="ReceiversEmail" value="" />
</div>

<br/>

<div class="block">
<label>{"Subject"|i18n("design/standard/content/tipafriend")}</label><div class="labelbreak"></div>
<input class="box" type="text" size="40" name="Subject" value="" />
</div>

<div class="block">
<label>{"Comment"|i18n("design/standard/content/tipafriend")}</label><div class="labelbreak"></div>
<textarea class="box" cols="40" rows="15" name="Comment" value="" ></textarea>
</div>

<br/>

<div class="buttonblock'">
<input class="button" type="submit" name="SendButton" value="{'Send'|i18n('design/standard/content/tipafriend')}" />
<input class="button" type="submit" name="CancelButton" value="{'Cancel'|i18n('design/standard/content/tipafriend')}" />
</div>

<input type="hidden" name="NodeID" value="{$node.node_id}" />
</form>

Add following to your site.ini.append:

[ContentSettings]
CachedViewModes=full;sitemap;tipafriend

So you are able to cache the 1st page of the "tip a friend" feature.

I hope that helps.

Kind regards,
Emil.

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Georg Franz

Wednesday 24 March 2004 9:09:00 am

... I forgot:

If you use the "view mode"-version, the link to the "tip a friend" page is:

content/view/tipafriend/{$node.node_id}

Kind regards,
Emil.

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Josh Sowin

Wednesday 24 March 2004 12:47:47 pm

Wow, thanks for the full treatment on this! I am glad it is built in.
I will have to play with this and see if I can get it working.
Thank you SO much for your help!!

-Josh