Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Sidepanel Rotator
This discussion is related to the Sidepanel Rotator addon.

Sidepanel Rotator
0
This discussion has been closed.
Comments
Posted: Thursday, 14 June 2007 at 1:44PM
<?php /* Extension Name: Sidepanel Image Extension Url: http://lussumo.com/addons/ Description: Adds a rotating image with a link in the side panel Version: 1.0.0 Author: Justin Haury Author Url: http://mymindisgoing.com/ */ if (!defined('IN_VANILLA')) exit(); AddConfigurationSetting($Context, 'SIDEPANEL_IMAGE_VERSION', '1.0.0'); // Set the version number. define('SIDEPANEL_PATH', 'extensions/SidepanelImage'); $imgname = ""; $imglink = ""; // read in image names and links (for example, sample1.jpg,http://www.cnn.com) $fp = fopen(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]; // 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/SidepanelImage/$imgname\" class=\"center\"/></a></li> </ul>", 1); } 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/SidepanelImage/$imgname\" class=\"center\"/></a></li> </ul>", 1); } 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/SidepanelImage/$imgname\" class=\"center\"/></a></li> </ul>", 1); } 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/SidepanelImage/$imgname\" class=\"center\"/></a></li> </ul>", 1); } ?>
Warning: fopen(extensions/SidepanelImage//imglinks.txt) [function.fopen]: failed to open stream: No such file or directory in /home/skubeco/public_html/friends/extensions/SidepanelRotator/default.php on line 16
define('SIDEPANEL_PATH', 'extensions/SidepanelImage');
and I edited the post with the entire extension code.
The code should also be in it's own folder with the style and image files and imglinks.txt. I didn't want to make a new extension unless Krak thought that would be best.
Any ideas how to point to another folder? That may contain subfolders?
sample1.jpg,http://www.cnn.com
This information allows the code to put the "a href" tag around the image. That is what I thought the original request was. You must have a different idea since you are talking about folders and sub-folders. This code is a separate add-on from Krak's.
What is it that you want to do?
// read in image names and links (for example, sample1.jpg,http://www.cnn.com)
Ideally, I would like to have a random image in Side Panel selected from a main directory of my choosing. However, this main directory would also have several sub-folders each with images. Clicking the small image in Panel would enlarge the image (i.e. Thickbox).
I think I can figure out how to do the enlarging (now that I understand your 'make clickable' example). So I guess the tricky part is randomly picking a different folder/sub-folder with image thing...