Hi! Are there better instructions on how to use this block? The readme.txt didn't help me at all.
It's not a completed block. It must have gotten in there by accident as the promote.php file that gives them the code for the buttons isn't included.
I don't have a promote.php?
Yes. That's what I said. It's an unfinished block. It doesn't work.
๐ฎ Silly me! ๐ Okay, sorry!
Hi
there is a code for promote.php which I got from another thread but forgot what board. Here is the php code copied from my file. Make a promote.php page in your editor, save it to your website in main root / directory.
<?php
// ----------------------------------------------------------------------
// Copyright (c) 2007 by Tammy Keefer
// Based on eFiction 1.1
// Copyright (C) 2003 by Rebecca Smallwood.
// http://efiction.sourceforge.net/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
$current = $_GET['page'];
include ("header.php");
//make a new TemplatePower object
if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
else $tpl = new TemplatePower("default_tpls/default.tpl");
//let TemplatePower do its thing, parsing etc.
include("includes/pagesetup.php");
$directory = opendir(_BASEDIR."buttons");
$validTypes = array("jpg", "gif", "png");
while($filename = readdir($directory)) {
if($filename== "." || $filename== "..") continue;
$parts = explode(".", $filename);
if(!in_array($parts[1], $validTypes)) continue;
$images[] = $filename;
}
closedir($directory);
sort($images);
$text = "
<script language='javascript' type='text/javascript'>
var images = new Array( );
var current = 0;
var url = ' http://www.adriftindreams.com';
var sitename = '$sitename';
";
foreach($images AS $k => $i) {
$text .= "images[$k] = '$i';";
}
$text .= "
function imageSwitch(dir) {
img = document.getElementById('currentImage');
code = document.getElementById('imgCode');
current = current + dir;
if(images.length <= current) current = 0;
if(current < 0) current = images.length - 1;
newImage = new Image() ;
newImage.src = 'buttons/' + images[current];
img.src = 'buttons/' + images[current];
// remove the old code first.
while(code.firstChild) {
code.removeChild(code.firstChild);
}
text = document.createTextNode("<a href="'"" + url + "'><img src="'"" + url + "/buttons/" + images[current] + "' alt='" + sitename + "'></a>");
code.appendChild(text);
return false;
}
</script>
";
$text .= "<div id='imgContainer' style='text-align: center; margin: 1em;'><img id='currentImage' src="'buttons/".$images[0"]."'>";
$text .= "<div id='imgControls' style='text-align: center; margin: 1em;'><a href="'#'" onClick='imageSwitch(-1); return false;'>"._PREVIOUS."</a> | <a href="'#'" onClick='imageSwitch(+1); return false;'>"._NEXT."</a></div>";
$text .= "<div id='imgCode' style='border: 1px solid #222; margin: 0 10%; padding: 1ex;'><a href="' http://www.adriftindreams.com'><im g" src="' http://www.adriftindreams.com/buttons/".$images [0"]."' alt='$sitename'></a></div></div>";
$text .= "<div style='display:none;' ";
foreach($images AS $i) {
$text .= "<img src="'buttons/$i'" alt=' http://www.adriftindreams.com'>";
}
$text .= "</div>";
$tpl->assign("output", "<div id='pagetitle'>Help Promote Adrift In Dreams</div>nn
<p style='padding: 1em;'>Please help us promote Adrift In Dreams by linking to us. You may direct link to these images using the code provided below the image. The code is updated each time the image changes.</p>
$text");
$tpl->printToScreen();
dbclose( );
?>
change adrift in dreams to your site name where it says please help us promote..
hope this helps out sorry I cant find the thread with the php code in that is where I got the above code and it works great for me.
regards
Kate
