Tutorials
Manage affiliates with Flinx
-
Manage affiliates with Flinx
Posted on May 20, 2004
Written by
Sasha (view more by Sasha)
Comments (0)
Filed under Scripts: Flinx, Tutorials
Although phpAffili8 is a great script, it’s really only made for managing the affiliates of one site. If you own a lot of fanlistings, for example, and all of them have a collection of affiliates, adding them manually can be quite tedious and time-consuming over time. Because of this, I’ve hacked Flinx to handle as many affiliates for as many websites as you need.
The first thing you need to do is install Flinx as you normally would. Although renaming your tables isn’t necessary (unless you’ve got another installation of the script in the same database), I always rename mine to something like affs_links and affs_fl.
Once it’s been successfully installed, you can log into the admin panel; the first thing I do is add all of my fanlistings to the database via the ‘add new category’ option in the menu, just like you would do if you were adding a normal category. Personally, I name my categories after the folders the fanlistings are in. (IE: For my Chris Farley fanlisting, I would name the category ‘chris’.) Once you’ve done this, you can start adding your affiliates!
This part is pretty straight-forward; choose the category (or, in this case, fanlisting) from the drop-down menu on the ‘add new fanlisting’ page, type in the website’s name (or, in the case of fanlistings, the subject the fanlisting is for), etc.
Assuming all’s gone smoothly and your affiliate was added to the database, the next step is to edit the category.php file. Below is something similiar to what my own copy of the file looks like.
<?php
## Be sure to include the entire path, and not just 'config.php'. Otherwise, it won't work properly!
include("/home/domain/public_html/fan/affiliates/config.php");
$query = "SELECT linkID FROM $table_link WHERE relCatID = $id";
$queryl = mysql_query($query);
$count = mysql_numrows($queryl);
$result = mysql_query("SELECT name FROM $table_cat WHERE catID = $id");
if ($row = mysql_fetch_array($result)){
do{
?>
<p><?php echo $fltitle; ?> is currently affiliated with <strong><?php echo $count; ?></strong> sites. If you own a related fanlisting and would like to be added here, please send in a <a href="contact.php">contact</a> form.</p>
<?php
} while($row = mysql_fetch_array($result));
} else { print "<p align="left"><strong>No such category!</strong>"; }
?>
<p align=\"center\">
<?php
$result = mysql_query ("SELECT * FROM $table_link WHERE relCatID = $id ORDER BY name ASC");
if ($row = mysql_fetch_array($result)) {
do {
$width = $row["width"];
$height = $row["height"];
if ($width < 10){
$insert_width = "";
}else { $insert_width = " width=\"$width\""; }
if ($height < 10){
$insert_height = "";
}else { $insert_height = " height=\"$height\""; }
?>
<a href="<?php echo $row["url"]; ?>" target="<?php echo $target; ?>"><img border="0" src="<?php echo $base_url; ?><?php echo $row["image"]; ?>" alt="<?php echo $row["name"]; ?>" title="<?php echo $row["name"]; ?>"<?php echo $insert_width; ?><?php echo $insert_height; ?> /></a>
<?php
}while($row = mysql_fetch_array($result));
}else { print ""; }
?>
If you’ll notice, I have an additional variable called $fltitle. The value of this variable is specified in the fanlisting’s affiliates.php file, and its purpose is to supply the title of the fanlisting to which the affiliates belong. (IE: ‘Self-effacing is currently affiliated with 3 sites.’)
Now it’s time to make the affiliates.php file!
Doing this is relatively easy. As I mentioned above, we first need to specify the fanlisting’s title.
$fltitle = "Whatever";
Next, we need to tell the script what fanlisting to query. We do this by specifying the number Flinx has assigned to that category, which you can find by hovering over the link to the category on the main Flinx page. (It should look something like ‘http://www.yourdomain.com/affiliates/category.php?id=???’ in your status bar.) This variable will be called $id.
$id = 1;
Now all you need to do is include the category.php file!
include("/home/username/public_html/affiliates/category.php");
When you’ve completed the above steps, affiliates.php should (obviously) look something like this:
<?php
$fltitle = "Whatever";
$id = 1;
include("/home/username/public_html/affiliates/category.php");
?>
Voila! No more FTP!
Comments
Comments are closed for this entry.