473,796 Members | 2,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ad rotation on a website

Hi Everyone,

I am having trouble looking for a script that will rotate images from
a standard text file.

I have a folder set up with two images that rotate every time the page
is refreshed. They also have a hyperlink so that when an image/ad is
clicked on it goes to the advertiserments web address.
The only problem is that the path to the images and corresponding
hyperlink are in a javascript file.

Is it possible to reference them from a standard text file so that a
non-techie can login to webedit pro and edit the image name and url
everytime the ad is being changed ?

The script can be java scrip or preferably PHP, once it can reference
a .txt file...Im happy

Any help would be very much appreciated...

Stephen

Feb 22 '07 #1
3 1797
photo.txt

one.jpg,http://www.enemy.be,two.jpg,http://www.tuinwijk32.be
index.php (in same dir as pictures and textfile)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>read file</title>
</head>

<body>
<?php
$i = 0; // counter
$myFile = "photo.txt" ; // file to read
$fh = fopen($myFile, 'r'); // open file to read
$theData = fread($fh, filesize($myFil e)); // read the complete file
fclose($fh); // close connection to file
$part1 = split(",", $theData); // split at comma

foreach($part1 as $waarde) {
$kolom[$i] = $waarde; // put data in array ($kolom)
$i++; // counter = counter++
}
// $kolom[0] = foto1.jpg - $kolom[2] = foto2.jpg
$getal = ((rand(1, 2))%2 == 0) ? 0 : 2; // randomize
echo("<a href=\"" . $kolom[$getal + 1] . "\"><img src=\"" .
$kolom[$getal] . "\" alt=\"" . $kolom[$getal] . "\"></a>");
?>
</body>
</html>

Hope this helps

st***********@g mail.com schreef:
Hi Everyone,

I am having trouble looking for a script that will rotate images from
a standard text file.

I have a folder set up with two images that rotate every time the page
is refreshed. They also have a hyperlink so that when an image/ad is
clicked on it goes to the advertiserments web address.
The only problem is that the path to the images and corresponding
hyperlink are in a javascript file.

Is it possible to reference them from a standard text file so that a
non-techie can login to webedit pro and edit the image name and url
everytime the ad is being changed ?

The script can be java scrip or preferably PHP, once it can reference
a .txt file...Im happy

Any help would be very much appreciated...

Stephen
Feb 22 '07 #2
<comp.lang.ph p>
<>
<22 Feb 2007 05:55:27 -0800>
<11************ *********@s48g2 000cws.googlegr oups.com>
Is it possible to reference them from a standard text file so that a
non-techie can login to webedit pro and edit the image name and url
everytime the ad is being changed ?

The script can be java scrip or preferably PHP, once it can reference
a .txt file...Im happy
It would be quite easy to write a small script that would let you
add/edit the 2 line text file for each rotating banner .

text file 1
images/banner_one.jpg
http://www.yourdomain.com/cgi?=make

text file 2
images/banner_two.jpg
http://www.whatever.com/blah.html

On your actual webpage that uses them - its just a matter of generating
a random number in order to display the banner and use the url that
accompanys it .

Assuming you have 10 banners you want to rotate .....

rnd=(10)

Assuming the above picks 4 as the random number .....

file="banners/4.txt";
read line 1
read line 2

<divhref=url image </div>

I suppose you dont really need to write a suitable script in you create
the text files offline and upload & for the most part you would only
really need to generate a random number and read the 2 lines of text to
be used .
--
www.phptakeaway.co.uk
(work in progress)
Feb 22 '07 #3
Rik
On Thu, 22 Feb 2007 14:55:27 +0100, <st***********@ gmail.comwrote:
Hi Everyone,

I am having trouble looking for a script that will rotate images from
a standard text file.

I have a folder set up with two images that rotate every time the page
is refreshed. They also have a hyperlink so that when an image/ad is
clicked on it goes to the advertiserments web address.
The only problem is that the path to the images and corresponding
hyperlink are in a javascript file.

Is it possible to reference them from a standard text file so that a
non-techie can login to webedit pro and edit the image name and url
everytime the ad is being changed ?

The script can be java scrip or preferably PHP, once it can reference
a .txt file...Im happy

Any help would be very much appreciated...

Check out fgetcsv(), and possibly fputcsv() if you want to make an
interface to it later.
--
Rik Wasmus
Feb 23 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3841
by: M. Clift | last post by:
Hi All, Could someone help me out with this? items = ('a', 'b', 'c', 'd') items + 1 = ( 'b', 'c', 'd', 'a') items + 2 = ( 'c', 'd', 'a', 'b') items + 3 = ( 'd', 'a', 'b', 'c') trans = 1
2
1813
by: Kevin | last post by:
Hello all. I am new to Java script and trying to get a jpeg rotation on my website to work. I found the script here: http://www.laughland.biz/javascript.php?scid=3 I am trying to get this page http://www.yoursourceinjapan.com/testing.htm to display pics that automatically rotate. Could someone take a look at my script and let me know where I have goofed? Many thanks -and Happy New Year Kevin
5
3507
by: Russell Warren | last post by:
Does anyone have an easier/faster/better way of popping from the middle of a deque than this? class mydeque(deque): def popmiddle(self, pos): self.rotate(-pos) ret = self.popleft() self.rotate(pos) return ret
2
2112
by: the other john | last post by:
I am looking for ideas on how to create a rollover that triggers an image rotation in another location. I know how to create a function for basic rollovers, image swapping sort of thing, but I know know how to create the rotation. This is what the client wants... ....create a circle of images, each of which will trigger an image rotation in the center of this circle until the mouseout. Yea, I'm a little green with js.
1
1985
by: number1hatfielder | last post by:
Hi there, I am trying to include some javascript in my website which rotates some stored images. I have attached the code for the index page of my website as i am having some problems getting it to work. Can anyone see where i am going wrong? This is my first attempt. Here is the source script:
0
1806
by: VorTechS | last post by:
I'm having a problem with an inherited label, applying text rotation to aligned text. If text rotation is applied to the aligned text, the alignment goes 'nuts'. I can find no logic to what is happening. I've built the following code from several examples on the web, if you remove the rotation then alignment works fine: Imports System.ComponentModel
2
3825
by: Roger Li | last post by:
I got a problem about the mean rotation calculation. I have a group of rotation matrics in my program and I want to calculate the mean rotation on the basis of these rotation matrics. I think it is a general mathmatical problem. So I wanna know where I can find the code or math lib written in C++.
6
7203
by: Ramtin Kazemi | last post by:
Hi How can i perform bitwise rotation in C#?
6
3872
by: elrondrules | last post by:
I want to create a simple log rotation for the following scenario: I have a script that when executed will write debug and error messages to a specific file (say script.log). I want to create log rotation such a way that if the file size of script.log exceeds say 500KB, I want to rename script.log as script<day>1.log and the latest logs to be written to script.log. Essentially script.log should have the recent 500KB of logs.
8
9434
by: infoseekar | last post by:
Image Resize & Rotation Hi I have 2 scripts, one for Image rotation and other image resize and they both are working. Image resize scripts load the picture and resize it and Image rotation rotate the image by 90 deg. They are two differennt files i.e. resize.php and rotate.php. What I want to do is to combine both rotate.php & resize.php files, so when the script resized the image than it will call rotate script to rotate the...
0
9683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9529
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10231
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10013
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6792
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4119
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.