Personal tools

Referer how-to

by ats last modified 2005-11-21 22:56

How to store/show referer informations in your COREBlog.

With COREBlogRefererPlugin , you can store/show referer information in your Blog :-).

  • Merit
    • Having fun :-)
  • Risk
    • Loss of performance. This plugin store referer information in ZODB, so it add data to ZODB, everytime someone clicks link to your blog.

To install COREBlogRefererPlugin, follow instructions bellow.

Download and install Plugin Product.

Download COREBlogRefererPlugin.

This is Zope product, which works with COREBlog.

Extract archive to Product directory, and restart Zope.

Add Plugin object

Go to COREBlog's contents tab. Then add COREBlogRefererPlugin. ID must be default.

Add some code to DTML

In index_html, somewhere inside <dtml-in "rev_day_entry_items(count=top_days)"> loop, add code bellow.

This code is to store referer information for top of your blog.

 <dtml-comment>### Add referer information ###</dtml-comment>
 <dtml-if sequence-start>
 <dtml-try>
 <dtml-call "referer_plugin.addReferer(id,REQUEST)">
 <dtml-except>
 </dtml-try>
 </dtml-if>

In the end of entry_body, add code bellow.

This code is to store referer information for permalink.

 <dtml-comment>### Add referer information ###</dtml-comment>
 <dtml-try>
 <dtml-call "referer_plugin.addReferer(id,REQUEST)">
 <dtml-except>
 </dtml-try>

In entry_body, front of final </div> , add code bellow.

This code is to show referer informations.

 <dtml-try>
 <dtml-comment>### Show Referer ###</dtml-comment>
 <a name="referer"></a>
 <dtml-in "referer_plugin.getReferer(id)">
 <dtml-if sequence-start>
 <div class="comments-head"><a name="comments"></a>Referer</div>
 <div class="posted">
 </dtml-if>
 <a href="<dtml-var referer_url>"><dtml-var "_['sequence-index']+1">
 ...[<dtml-var referer_count>]
 </a> 
 <dtml-if sequence-end>
 </div>
 </dtml-if>
 <dtml-else>
 </dtml-in>
 <dtml-except>
 </dtml-try>
 
If you want to prevent "Rererer spam", add * rel="nofollor" * attribute to Hyper Link.

Like this.

 <dtml-try>
 <dtml-comment>### Show Referer ###</dtml-comment>
 <a name="referer"></a>
 <dtml-in "referer_plugin.getReferer(id)">
 <dtml-if sequence-start>
 <div class="comments-head"><a name="comments"></a>Referer</div>
 <div class="posted">
 </dtml-if>
 <a href="<dtml-var referer_url>" rel="nofollow"><dtml-var "_['sequence-index']+1">
 ...[<dtml-var referer_count>]
 </a> 
 <dtml-if sequence-end>
 </div>
 </dtml-if>
 <dtml-else>
 </dtml-in>
 <dtml-except>
 </dtml-try>
 

See [Thisentry:http://www.google.com/googleblog/2005/01/preventing-comment-spam.html] of Google blog for details.

You are here: Home Hot-Tos Referer how-to
About COREBlog
COREBlog2 (for Plone users)
The current version of COREBlog2 (for Plone) is 0.982b (released 2007/4/13)
Download now!
How-Tos
To learn more about COREBlog visit the How Tos
Mailing list for COREBlog users
There is a mailinglist for COREBlog in English. Thanks, Klaus san :-).
COREBlog2 (for Plone users)
The current version of COREBlog2 (for Plone) is 0.982b (released 2007/4/13)
Download now!
Bugs/Feature Requests
If you have bug reports or feature requests, please add new ticket to trac for COREBlog2. Be sure to write your name and email address so I can contact to you :-).
COREBlog (for Zope users)
The current version of COREBlog (for Zope) is 1.2.5 (relaased 2006/04/03)
Download now!
How-Tos
To learn more about COREBlog visit the How Tos
Mailing list for COREBlog users
There is a mailinglist for COREBlog in English. Thanks, Klaus san :-).
 

Powered by Plone, the Open Source Content Management System