Page 2 of 2
Posted: Fri Jun 30, 2006 10:51 am
by battye
Try something like this
Code: Select all
<?php
srand ((double) microtime( )*1000000);
$numbanners = 7;
$banner = rand(0,$numbanners);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
include($phpbb_root_path . "includes/page_header.$phpEx");
$template->set_filenames(array("xxxxxxx" => '' . $banner . '.tpl'));
$template->assign_vars( array("VAR" => $var));
$template->pparse("xxxxxxx");
include($phpbb_root_path . "includes/page_tail.$phpEx");
?>
Posted: Fri Jun 30, 2006 11:32 am
by Leon
If i would add that into the header it would become doublets code.
The heade has so much code in it so i cant just "start from scrats"
And delit everything and just add this code instead..
Or do i need to add the page_tail, sessions and whoaata.
should i add the page_heaeder into the headers code ?
A header whitin the header
Something tells me we thinking of two different things here..
I want simply include the code from banner.php in the header
as a {rotatebanners} or something...
Posted: Fri Jun 30, 2006 12:37 pm
by battye
Okay, I think I am thinking of something different as well.
You want a different header to be loaded at random? So instead of this picture below, you want one of seven random pictures?

Posted: Fri Jun 30, 2006 2:09 pm
by Leon
nononono.
THIS is the random banner.php file
http://www.volunteerforum.se/overallhea ... anners.php
open it and take some refresh'ings...
The problem is that i cant use include on that file in the tpl file
When it is done it gona look something like this test i did before..
(And this works only because its no root php ect whit it. only 1 php file that makes it all, and the forum as an image)
http://www.volunteerforum.se/Minmapp/Po ... /blue2.php
Posted: Fri Jun 30, 2006 2:16 pm
by battye
Ah! I see what you mean, that is easily done.
Wherever you want the banner, simply put:
Code: Select all
file_get_contents('http://www.volunteerforum.se/overallheader/RandomBanner/rotate_nr/banners.php');
Posted: Fri Jun 30, 2006 2:30 pm
by Leon
Are you sure you diden't forget anything ?
I see only the text you gaved me:
http://www.volunteerforum.se/testpage.php
Posted: Fri Jun 30, 2006 2:31 pm
by battye
Can you post the area you included it in?
Posted: Fri Jun 30, 2006 2:34 pm
by Leon
The full test_header.tpl
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="description" content="Volunteer Forum, Volontär Forum, Talk Discuss or Debate Volunteer 'ing" />
<meta name="keywords" content="Volunteer forum, Volontär forum, Community, Organisations, Portal, Website, Photo, Volunteer" />
<meta name="Author" content="Volunteer Forum" />
{META}
{NAV_LINKS}
<title>Volunteer Forum - {PAGE_TITLE}</title>
<link rel="stylesheet" href="{T_TEMPLATE_PATH}/style_{TPL_COLOR}.css" type="text/css" />
<style type="text/css">
<!--
@import url("{T_TEMPLATE_PATH}/formIE.css");
-->
</style>
<script language="javascript" type="text/javascript">
<!--
var PreloadFlag = false;
var expDays = 90;
var exp = new Date();
var tmp = '';
var tmp_counter = 0;
var tmp_open = 0;
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function SetCookie(name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape(value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function getCookieVal(offset)
{
var endstr = document.cookie.indexOf(";",offset);
if (endstr == -1)
{
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie(name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal(j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function ShowHide(id1, id2, id3)
{
var res = expMenu(id1);
if (id2 != '') expMenu(id2);
if (id3 != '') SetCookie(id3, res, exp);
}
function expMenu(id)
{
var itm = null;
if (document.getElementById)
{
itm = document.getElementById(id);
}
else if (document.all)
{
itm = document.all[id];
}
else if (document.layers)
{
itm = document.layers[id];
}
if (!itm)
{
// do nothing
}
else if (itm.style)
{
if (itm.style.display == "none")
{
itm.style.display = "";
return 1;
}
else
{
itm.style.display = "none";
return 2;
}
}
else
{
itm.visibility = "show";
return 1;
}
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#3B88C5" vlink="#3279B2" alink="#FF9C00">
<a name="top"></a>
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%" align="center">
<tr>
<td width="10" class="border_left">
<img src="{T_TEMPLATE_PATH}/images/spacer.gif" width="10" height="1" alt="" />
</td>
<td width="100%" height="100%" class="content" align="center" valign="top">
<TABLE BORDER="1" BGCOLOR="#DADADA" borderColorLight="#5F74A1" WIDTH="100%" HEIGHT="158" CELLPADDING="0" CELLSPACING="0" ALIGN="CENTER">
<TR>
<TD VALIGN="TOP" BGCOLOR="#EFF3F6" BACKGROUND="http://www.volunteerforum.se/overallheader/BG_Pic/headern_ostersjon.gif" style="background-repeat:no-repeat;">
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD VALIGN="TOP" WIDTH="50%" ALIGN="LEFT">
<A href="http://www.volunteerforum.se/portal.php"><IMG SRC="http://www.volunteerforum.se/overallheader/logo.gif" ALT="Volunteer Community" BORDER="0"></A>
<FONT color=#3266D4>
<SPAN colour="DADADA" style="FONT-SIZE: 44px; LINE-HEIGHT: normal">Volunteer Forum</SPAN>
</FONT>
</TD>
<TD VALIGN="MIDDLE" WIDTH="50%" ALIGN="LEFT">
file_get_contents('http://www.volunteerforum.se/overallheader/RandomBanner/rotate_nr/banners.php');
</TD>
</TR>
</TABLE>
<br>
<br>
<br>
<br>
<br>
<br>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" ALIGN="CENTER" BORDERCOLOR="#FFFFFF" WIDTH="100%" BGCOLOR="#EFF3F6">
<TR>
<TD VALIGN="BOTTOM">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" ALIGN="CENTER">
<TR>
<TD VALIGN="MIDDLE" BGCOLOR="#EFF3F6">
<style type="text/css">
#csstopmenu, #csstopmenu ul{
padding: 0;
margin: 0;
list-style: none;
}
#csstopmenu li{
float: left;
position: relative;
}
#csstopmenu a{
text-decoration: none;
}
.mainitems{
border: 0px solid blue;
border-left-width: 0;
background-color: #EFF3F6;
}
.headerlinks a{
margin: auto 9px;
font-weight: bold;
color: #2355C0;
}
.submenus{
display: none;
width: 13em;
position: absolute;
top: 1.2em;
left: 0;
background-color: #FAFAFA;
border: 1px solid silver;
}
.submenus li{
width: 100%;
}
.submenus li a{
display: block;
width: 100%;
text-indent: 3px;
border: 1px solid white;
}
html>body .submenus li a{ /* non IE browsers */
width: auto;
}
.submenus li a:hover{
background-color: #EFEFEF;
color: black;
}
#csstopmenu li>ul {/* non IE browsers */
top: auto;
left: auto;
}
#csstopmenu li:hover ul, li.over ul {
display: block;
}
html>body #clearmenu{ /* non IE browsers */
height: 3px;
}
</style>
<script type="text/javascript">
startMenu = function() {
if (document.all&&document.getElementById) {
cssmenu = document.getElementById("csstopmenu");
for (i=0; i<cssmenu.childNodes.length; i++) {
node = cssmenu.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function(){
this.className=this.className.replace(" over", "")
}
}
}
}
}
if (window.attachEvent)
window.attachEvent("onload", startMenu)
else
window.onload=startMenu;
</script>
<ul id="csstopmenu">
<li class="mainitems">
<div class="headerlinks"><a href="http://www.volunteerforum.se/portal.php">•Portal</a></div>
</li>
<li class="mainitems">
<div class="headerlinks"><a href="http://www.volunteerforum.se/index.php">•Forum</a></div>
</li>
<li class="mainitems">
<div class="headerlinks"><a href="#"><IMG SRC="http://www.volunteerforum.se/overallheader/ar1.gif">Navigation</a></div>
<ul class="submenus" style="width: 14em">
<DIV align=left>
<li><a href="http://www.volunteerforum.se/portal.php">Portal</a></li>
<li><a href="http://www.volunteerforum.se/index.php">Forum</a></li>
<li><a href="http://www.volunteerforum.se/blog.php">Blog</a></li>
<li><a href="http://www.volunteerforum.se/links.php">Links</a></li>
<li><a href="http://www.volunteerforum.se/search.php">Search</a></li>
<li><a href="http://www.volunteerforum.se/websiteindex.php">Website</a></li>
<li><a href="http://www.volunteerforum.se/album.php">Photo Album</a></li>
<li><a href="http://www.volunteerforum.se/general.php">General Content</a></li>
</DIV>
</ul>
</li>
<!-- BEGIN switch_user_logged_in -->
<li class="mainitems">
<div class="headerlinks"><a href="#"><IMG SRC="http://www.volunteerforum.se/overallheader/ar1.gif">User Menu</a></div>
<ul class="submenus">
<DIV align=left>
<li><a href="http://www.volunteerforum.se/portal.php">Portal</a></li>
<li><a href="http://www.volunteerforum.se/index.php">Forum</a></li>
<li><a href="http://www.volunteerforum.se/profile.php?mode=editprofile">Profile</a></li>
<li><a href="http://www.volunteerforum.se/search.php">Search</a></li>
<li><a href="http://www.volunteerforum.se/memberlist.php">Memberlist</a></li>
<li><a href="http://www.volunteerforum.se/groupcp.php">User Groups</a></li>
<li><a href="http://www.volunteerforum.se/privmsg.php?folder=inbox">Private Messeges</a></li>
</DIV>
</ul>
</li>
<!-- END switch_user_logged_in -->
<!-- BEGIN switch_user_logged_out -->
<li class="mainitems">
<div class="headerlinks"><a href="#"><IMG SRC="http://www.volunteerforum.se/overallheader/ar1.gif">Guest Menu</a></div>
<ul class="submenus">
<DIV align=left>
<li><a href="http://www.volunteerforum.se/profile.php?mode=register">Register</a></li>
<li><a href="http://www.volunteerforum.se/portal.php">Portal</a></li>
<li><a href="http://www.volunteerforum.se/index.php">Forum</a></li>
<li><a href="http://www.volunteerforum.se/search.php">Search</a></li>
<li><a href="http://www.volunteerforum.se/whatis.php">What is a volunteer ?</a></li>
</DIV>
</ul>
</li>
<!-- END switch_user_logged_out -->
<li class="mainitems">
<div class="headerlinks"><a href="#"><IMG SRC="http://www.volunteerforum.se/overallheader/ar1.gif">General</a></div>
<ul class="submenus">
<DIV align=left>
<li><a href="http://www.volunteerforum.se/faq.php">FAQ</a></li>
<li><a href="http://www.volunteerforum.se/profile.php?mode=register">Register</a></li>
<li><a href="http://www.volunteerforum.se/sitemap.php">Site Map</a></li>
<li><a href="http://www.volunteerforum.se/aboutus.php">About Us</a></li>
<li><a href="http://www.volunteerforum.se/contact_form.php">Contact Us</a></li>
<li><a href="http://www.volunteerforum.se/whatis.php">What is a volunteer ?</a></li>
</DIV>
</ul>
</li>
<li class="mainitems">
<div class="headerlinks"><a href="{U_LOGIN_LOGOUT}">•{CA_L_LOGIN_LOGOUT}</a></div>
</li>
<!-- BEGIN switch_user_logged_out -->
<li class="mainitems">
<div class="headerlinks"><a href="http://www.volunteerforum.se/profile.php?mode=register"> •Register</a></div>
</li>
<!-- END switch_user_logged_out -->
</ul>
<div id="clearmenu" style="clear: left"></div>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<div id="content">
<!-- BEGIN switch_xs_enabled -->
<?php if($this->vars['CA_NEW_MSGS'] && $this->vars['PRIVATE_MESSAGE_INFO'] !== $this->vars['CA_L_NO_MSG'] && !defined('CA_POPUP_SHOWED')) { ?>
<div id="newmsgs"><a href="{U_PRIVATEMSGS}" class="newmsgs">{PRIVATE_MESSAGE_INFO}</a></div>
<?php define('CA_POPUP_SHOWED', true); } ?>
<!-- END switch_xs_enabled -->
<!-- BEGIN ca_new_privmsgs -->
{CA_XS_COMMENT_START}<div id="newmsgs"><a href="{U_PRIVATEMSGS}" class="newmsgs">{ca_new_privmsgs.TEXT}</a></div>{CA_XS_COMMENT_END}
<!-- END ca_new_privmsgs -->
Posted: Fri Jun 30, 2006 2:36 pm
by battye
Ah, you can't put it directly into the TPL file, you will need to pass it through
Code: Select all
$template->assign_vars(array("FILEGET" => file_get_contents('http://www.volunteerforum.se/overallheader/RandomBanner/rotate_nr/banners.php')));
Then include {FILEGET} in the TPL where you want the banner.
Posted: Fri Jun 30, 2006 2:43 pm
by Leon
Perfect...
Seems like everything is in working ordeer now..
Only the ugly background pic that i gona change later..
Need to do some debugging first also...
But i think everything is in working order now
Thanks battye
// The problemfinder

Posted: Fri Jun 30, 2006 2:50 pm
by battye
You're welcome Leon
Check your PM's 