One solution is to change the lines in the default.php that have the li tag to: <li class=\"BannerImage\" style=\"border:0px;\">
A better solution is to add the following to the style.css (which I forgot - sorry): #Banner li.BannerImage {
border:0px;
} Then any adjustments to the BannerImage class for fine tuning of the images will be done here.
I have a question now. :) How can I rename this file and uplaod a second? Let me make sure I make sense. LOL
I want to have 2 of the image links in my panel. One on top of the other. I treid to rename and upload it but I got errors. Do you know if that is possible and any tips you all have to share. Thanks in advance.
Just to be clear, do you want to use the images that are in the imglinks.txt file twice or do you want to have a second imglinks.txt file?
Edit: It's actually easy using one imglinks file. Add this after the "randomly choose one" code. It's just a copy of what is there with $pos, $imgname and $imglink with new names: // And then randomly choose a second one
$pos1 = mt_rand(0, $i - 1 );
$imgname1 = $images[$pos1];
$imglink1 = $links[$pos1]; Then copy the "li class" link for the page on which you want two images to show and paste it right below what you copied. Then change the $imglink to $imglink1 and $imgname to $imgname1 as in the following example: <li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li>
The AddString line of code should look like: $Panel->AddString("
<ul id=\"Banner\">
<li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li>
<li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li>
</ul>", SIDEPANEL_POSITION);
I want to use whole other ads. I like the three random that are there now. They are great! I wanted to add a whole other set of mini-banners under it with differnt links. I have several websites and I want to put on my ads to all of them. Thanks so much!
It sounds like you want a second file with images and links. You could modify the script again where it opens the one file now. Just duplicate the open and loading of the arrays with the new filename and change $images to $images1 and $links to $links1. Then use these arrays in loading $imgname1 and $imglink1.
If this is what you want, I can help you if you want.
Here is the new default.php code for you. Copy it and save it as default.php and put in the SidepanelImageLink folder. Rename the old default.php first, in case you want to go back to it. I tested i and it works. Don't forget to create a new file called imglinks1.txt and put it in the SidepanelImageLink folder.
<?php
/*
Extension Name: Sidepanel Image Link
Extension Url: http://lussumo.com/addons/
Description: Adds a random/rotating image in the side panel which links to a url. This is based on Justin Haurys (http://mymindisgoing.com/) add-on SidepanelRotator.
Version: 1.0.1
Author: Jim Wurster
Author Url: http://www.jwurster.us/
*/
if (!defined('IN_VANILLA')) exit();
AddConfigurationSetting($Context, 'SIDEPANEL_IMAGE_LINK_VERSION', '1.0.1'); // Set the version number.
define('SIDEPANEL_PATH', 'extensions/SidepanelImageLink/');
define('SIDEPANEL_POSITION', 1);
$imgname = "";
$imglink = "";
// read in image names and links (for example, sample1.jpg,http://www.cnn.com)
$fp = fopen($Configuration['APPLICATION_PATH'].SIDEPANEL_PATH.'imglinks.txt', 'rb');
if(!$fp) return;
$i = 0;
while ($row = fgetcsv($fp, 1000))
{
list($images[$i], $links[$i]) = $row;
$i++;
}
fclose($fp);
// And then randomly choose one
$pos = mt_rand(0, $i - 1 );
$imgname = $images[$pos];
$imglink = $links[$pos];
// read in image names and links (for example, sample1.jpg,http://www.cnn.com)
$fp = fopen($Configuration['APPLICATION_PATH'].SIDEPANEL_PATH.'imglinks1.txt', 'rb');
if(!$fp) return;
$i = 0;
while ($row = fgetcsv($fp, 1000))
{
list($images1[$i], $links1[$i]) = $row;
$i++;
}
fclose($fp);
// And then randomly choose a second one
$pos1 = mt_rand(0, $i - 1 );
$imgname1 = $images1[$pos1];
$imglink1 = $links1[$pos1];
//
if ($Context->SelfUrl == "index.php" ) {
$Head->AddStyleSheet(SIDEPANEL_PATH.'style.css');
$Panel->AddString("
<ul id=\"Banner\">
<li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li>
<li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li>
</ul>", SIDEPANEL_POSITION);
}
elseif ($Context->SelfUrl == "categories.php" ) {
$Head->AddStyleSheet(SIDEPANEL_PATH.'style.css');
$Panel->AddString("
<ul id=\"Banner\">
<li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li>
<li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li>
</ul>", SIDEPANEL_POSITION);
}
elseif ($Context->SelfUrl == "search.php" ) {
$Head->AddStyleSheet(SIDEPANEL_PATH.'style.css');
$Panel->AddString("
<ul id=\"Banner\">
<li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li>
<li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li>
</ul>", SIDEPANEL_POSITION);
}
elseif ($Context->SelfUrl == "account.php" ) {
$Head->AddStyleSheet(SIDEPANEL_PATH.'style.css');
$Panel->AddString("
<ul id=\"Banner\">
<li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li>
<li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li>
</ul>", SIDEPANEL_POSITION);
}
?>
I fixed all my previous issues with this. I really like how light weight this. One thing is sometimes it returns no image at all, as well as the images are only seen on the homepage. How can I make it visible on all pages?
Comments
<li class=\"BannerImage\" style=\"border:0px;\">
A better solution is to add the following to the style.css (which I forgot - sorry):
#Banner li.BannerImage { border:0px; }
Then any adjustments to the BannerImage class for fine tuning of the images will be done here.
Edit: It's actually easy using one imglinks file. Add this after the "randomly choose one" code. It's just a copy of what is there with $pos, $imgname and $imglink with new names:
// And then randomly choose a second one $pos1 = mt_rand(0, $i - 1 ); $imgname1 = $images[$pos1]; $imglink1 = $links[$pos1];
Then copy the "li class" link for the page on which you want two images to show and paste it right below what you copied. Then change the $imglink to $imglink1 and $imgname to $imgname1 as in the following example:
<li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li>
The AddString line of code should look like:
$Panel->AddString(" <ul id=\"Banner\"> <li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li> <li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li> </ul>", SIDEPANEL_POSITION);
If this is what you want, I can help you if you want.
<?php /* Extension Name: Sidepanel Image Link Extension Url: http://lussumo.com/addons/ Description: Adds a random/rotating image in the side panel which links to a url. This is based on Justin Haurys (http://mymindisgoing.com/) add-on SidepanelRotator. Version: 1.0.1 Author: Jim Wurster Author Url: http://www.jwurster.us/ */ if (!defined('IN_VANILLA')) exit(); AddConfigurationSetting($Context, 'SIDEPANEL_IMAGE_LINK_VERSION', '1.0.1'); // Set the version number. define('SIDEPANEL_PATH', 'extensions/SidepanelImageLink/'); define('SIDEPANEL_POSITION', 1); $imgname = ""; $imglink = ""; // read in image names and links (for example, sample1.jpg,http://www.cnn.com) $fp = fopen($Configuration['APPLICATION_PATH'].SIDEPANEL_PATH.'imglinks.txt', 'rb'); if(!$fp) return; $i = 0; while ($row = fgetcsv($fp, 1000)) { list($images[$i], $links[$i]) = $row; $i++; } fclose($fp); // And then randomly choose one $pos = mt_rand(0, $i - 1 ); $imgname = $images[$pos]; $imglink = $links[$pos]; // read in image names and links (for example, sample1.jpg,http://www.cnn.com) $fp = fopen($Configuration['APPLICATION_PATH'].SIDEPANEL_PATH.'imglinks1.txt', 'rb'); if(!$fp) return; $i = 0; while ($row = fgetcsv($fp, 1000)) { list($images1[$i], $links1[$i]) = $row; $i++; } fclose($fp); // And then randomly choose a second one $pos1 = mt_rand(0, $i - 1 ); $imgname1 = $images1[$pos1]; $imglink1 = $links1[$pos1]; // if ($Context->SelfUrl == "index.php" ) { $Head->AddStyleSheet(SIDEPANEL_PATH.'style.css'); $Panel->AddString(" <ul id=\"Banner\"> <li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li> <li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li> </ul>", SIDEPANEL_POSITION); } elseif ($Context->SelfUrl == "categories.php" ) { $Head->AddStyleSheet(SIDEPANEL_PATH.'style.css'); $Panel->AddString(" <ul id=\"Banner\"> <li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li> <li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li> </ul>", SIDEPANEL_POSITION); } elseif ($Context->SelfUrl == "search.php" ) { $Head->AddStyleSheet(SIDEPANEL_PATH.'style.css'); $Panel->AddString(" <ul id=\"Banner\"> <li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li> <li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li> </ul>", SIDEPANEL_POSITION); } elseif ($Context->SelfUrl == "account.php" ) { $Head->AddStyleSheet(SIDEPANEL_PATH.'style.css'); $Panel->AddString(" <ul id=\"Banner\"> <li class=\"BannerImage\"><a href=\"$imglink\"><img src=\"extensions/SidepanelImageLink/$imgname\" class=\"center\"/></a></li> <li class=\"BannerImage\"><a href=\"$imglink1\"><img src=\"extensions/SidepanelImageLink/$imgname1\" class=\"center\"/></a></li> </ul>", SIDEPANEL_POSITION); } ?>