I decided to do something what does not disturb your design, is very visible and users are willing to click on it. I´ve spent many hours developing this dirty addon, but please keep in mind this is absolutely dirty solution and if you want to do this, you should have at least absolutely basic programming knowledge. One way or another please make backup of files we are going to edit (so no replies of kind "i kill you that thing destroyed my amazing pligg site" will be accepted). However I will try to do my best for explaining every step and i hope you will made it with satisfaction
.The result looks like this:

I´m using Google Adsense banner for this, about code and size i will inform you later. I suppose you can also use Yahoo or Microsoft advertising.
Addon Description
- Your advertising link is displayed when published links are supposed to be shown, you can customize link design via css
- You can customize how many links at least has to be in selected category (or subcategory or all) to be advertising link displayed, please note that these customization is also limited by page size which can be set in your admin panel.
- Displaying of advertising link is RANDOM. I suppose no one would be interested in advertising link which is forever at the x position.
- Advertising link - as you can see in the picture - has no comments, category etc. shown, symbol ":-)" is "clickable", it is refreshing page and changing position of advertising link.
Reguirements
- Some brain - without that its highly risky
- Pligg v.9.7, however i assume you should be able to integrate into older vesions
- Notepad ++ or PHP Designer or PhpEd or combination (my favorite

- Google Adsense Account (or similar) and to know how add banners into page
- PHPMyAdmin or command shell(good luck with it
for doing some things in database- A few hours freetime
Limitations
This tutorial is designed for:
- searching method:3
- default (no star) voting
- default url method
This is my configuration. If your configuration is different, you will probably (ok if you got star voting method its 100%) did some own customizations=>you should something know about php.
Part 2 - Editing
2.1.1 Creating new user
This is optional. Personally I created new with name "Advertiser". This is recommendet for people who like experimenting.
2.1.2 Creating new link
This is absolutely required. Go to your phpMyAdmin (so logg in your database), customize and run this sql:
Code:
INSERT INTO `your_domain_links` (`link_id`, `link_author`) VALUES (100, 6);
Why this link id?This value must be changed. As you well know, primary key must be unique so set this number to number you havent.
You will have to change also this number in every file we will edit to your own. In my case I use my link_id=100. For me it is the highest link_id value.I am not sure what auto_icrement value does if you set link_id bigger then it is. To avoid errors you should run this SQL query in your php admin:
Code:
alter table your_domain_links auto_increment=101;
Why this link_author? This value is supposed to be edited, when I created user "Advertiser" his user_id=6 so set this number to user you want to be owner.
Now,we want to edit this link directly,so click on this link to edit it. You should now be in edit mode,ok? Do following changes:
link_id: no change (100)
link_author: no change (your value from previous step)
link_id: published
link_rankey:7965648 (you can make your own random key,does not matter)
link_votes: no change - will be set automatically
link_reports:no change (0)
link_comments:no change (0)
link_karma:1
link_modified:no change (now() will be set automatically)
link_date:no change,will be set automatically
link_published_date:no change,will be set automatically
link_category:1
link_lang:1
link_url:no change (none)
link_url_title:no change (none)
link_title:no change (none)
link_title_url:no change (none)
link_content:no change (none)
link_summary:your adsense script ,I recommend to give it into <div> and set the same color as is banner border color,personaly i have:
Code:
<div style="background: #eff5ff; width:468px; height: 70px"> <script type="text/javascript"><!-- google_ad_client = "pub-6458346793444195"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text"; //2007-08-30: VÅ*Elink / Novinky google_ad_channel = "3121957991"; google_color_border = "eff5ff"; google_color_bg = "F7F9FD"; google_color_link = "0014d6"; google_color_text = "000000"; google_color_url = "5092FE"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div>
.Save the changes. We dont longer need phpAdmin.
2.1.3 Editing link.php in your ../libs/ directory
So what we have to do. In this file we will decide if link is our special advertising link and if so, we will do some (ok a little more) queries to get neccessary data, we need information about num of links in specific desired category (or without it), for random positioning we need to know:
- min date of links which are supposed to be displayed
- max date
- min votes
- max votes
Why date and votes? Beceause links are sorted by DATE or by number of VOTES (or both
. When we have these informations, we can make random date and random count of votes between max date and min date (and between max votes and min votes). The next information we need to know if our link was shown only one times and it is also necessary to assign smarty value to let know some *.tpl file (details later) that this link is special and design is supposed to be changed. OK, enough theory, there is a code which you have to add to link.php before //for friends section (it is somewhere in the middle about line 400, just press ctrl+f and search for friends):
[End of Post 1 the rest is in next post]




