Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Here's a follow-up to what you'll need to do if including everything in the header template (a little extra code req'd)...

Example (displaying 3 images from a pool of 3 possible):

<? //UBBTREMARK

$image_html = array();

// Insert the HTML code below for each image or banner in the pool (don't forget the \ before the ")
// You can also add individual ALT and TITLE tags if you wish

$image_html[0] = "<a href="http://www.example1.com"><img src="images/1.gif" border="0"></a>";
$image_html[1] = "<a href="http://www.example2.com"><img src="images/2.jpg" border="0"></a>";
$image_html[2] = "<a href="http://www.example3.com"><img src="images/3.png" border="0"></a>";

// Configure the number of unique images or banners to be displayed on the page
// It can be any number from 0-6 in the example given

$number_of_images = 3; // <-- Configure

$random = array_rand($image_html, $number_of_images);

[:"red"]$image1 = $image_html[$random[0]];
$image2 = $image_html[$random[1]];
$image3 = $image_html[$random[2]];[/]


echo <<<UBBTPRINT
<!-- START OF header.tmpl TEMPLATE -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="{$ubbt_lang['READ_DIRECTION']}">
<head>
$headerinsert
$refresh
<meta http-equiv="Content-Type" content="text/html; charset={$ubbt_lang['CHARSET']}" />
<link rel="stylesheet" href="$stylesheet" type="text/css" />
<link rel="shortcut icon" href="{$config['images']}/loonyicon.ico" />
$javascript
<title>{$config['title']}: $inputTitle</title>
</head>
<body>
[:"red"]<center>
$image1
$image2
$image3
</center> [/]
<!-- END OF header.tmpl TEMPLATE -->
UBBTPRINT
/* UBBTREMARK */ ?>


Now notice the parts in red.

The first red section is *new code* you'll need, which converts the randomized array into single variables. It's pretty straight-forward.

The second red section is what will actually display the images now with the variables we just created above.

I think it's pretty easy to understand eh? That will now absolutely make everything work using this method!

Sponsored Links
Entire Thread
Subject Posted By Posted
Finished-[All] Multiple Random Banners v1.1 (No Duplicates) *updated* Twisty 10/21/2004 10:52 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/25/2004 3:11 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 1:14 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 1:19 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 1:36 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 1:39 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 2:04 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 2:07 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 2:23 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 2:35 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 2:56 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 3:07 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 3:27 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 3:59 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 4:34 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 4:45 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 5:09 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 5:33 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 5:39 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 11:18 AM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 12:17 PM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 1:29 PM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 5:13 PM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 7:56 PM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 8:03 PM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 9:47 PM
Re: Finished-[All] Multiple Random Banners (No Duplicates) ChAoS_dup1 10/26/2004 10:41 PM
Re: Finished-[All] Multiple Random Banners (No Duplicates) Twisty 10/26/2004 10:54 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
hatter
hatter
USA
Posts: 69
Joined: January 2001
Forum Statistics
Forums63
Topics37,575
Posts293,932
Members13,824
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,835
Greg Hard 4,625
Top Posters(30 Days)
Gizmo 1
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)