Referer how-to
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.