|
|
|
|
<?php
$text = file("game.dat");
$top = rand (0,count($text)-1);
$out = explode("|",$text[$top]);
print "$out[1]";
?>
|
Вот код при каждом обновлении станици ссылки меняются.
Как сделать чтобы на станицу выводилось 3 ссылки и они были разные. | |
|
|
|
|
|
|
|
для: Гном
(17.04.2007 в 19:44)
| | Этот код никаких ссылок не выводит.
Он выводит строки. Или точнее - фрагменты строк. | |
|
|
|
|
|
|
|
для: Гном
(17.04.2007 в 19:44)
| |
<?php
$text = file("game.dat");
$top1 = rand (0,count($text)-1);
$out1 = explode("|",$text[$top1]);
$top2 = rand (0,count($text)-1);
$out2 = explode("|",$text[$top2]);
$top2 = rand (0,count($text)-1);
$out2 = explode("|",$text[$top3]);
print "$out1[1]";
print "$out2[1]";
print "$out3[1]";
?>
|
| |
|
|
|
|
|
|
|
для: Гном
(17.04.2007 в 19:44)
| |
var banners = new Array(
"0611_3.gif", "eu-moda", "http://www.eu-moda.com/",
"0611_4.gif", "eu-moda", "http://www.eu-moda.com/",
"0611_5.gif", "eu-moda", "http://www.eu-moda.com/",
"0611_6.gif", "in-fashion", "http://www.in-fashion.gr.com/",
"0611_8.gif", "greekmoda", "http://www.greekmoda.com/",
"1710.gif", "eu-moda", "http://www.eu-moda.com/",
"1810_2.gif", "greekmoda", "http://www.greekmoda.com/",
"gm160x60.gif", "greekmoda", "http://www.greekmoda.com/",
"1611_2.gif", "in-fashion", "http://www.in-fashion.gr/",
"1611_3.gif", "in-fashion", "http://www.in-fashion.gr/",
"1611_4.gif", "in-fashion", "http://www.in-fashion.gr/",
"1911_4.gif", "in-fashion", "http://www.eu-moda.com/"
)
| //// это ваш game.dat у меня он назывется banners.js
а это - баннерокрутилка
<script language="JavaScript" src="banners.js"></script>
<script language="JavaScript">
<!--
var i, j;
var flag;
var banners_show = 3;
var banner_width = 160;
var banner_height = 60;
var rand = new Array(banners_show);
for (i=0; i<banners_show; i++) {
do {
flag=0;
n = Math.floor(Math.random()*(banners.length/3));
for (j=0; j<i; j++) {
if (n == rand[j]) {
flag=1;
}
}
} while (flag);
rand[i] = n;
}
function Show_Banner(number) {
n=rand[number-1];
document.write('<a href="' + banners[n*3+2] + '"><img src="pic/' + banners[n*3] + '" border=0 width=' + banner_width + ' height=' + banner_height + ' alt="' + banners[n*3+1] + '"></a>');
}
//-->
</script>
|
вызов там, где нужно:
<script>
Show_Banner(1);
</script>
<script>
Show_Banner(2);
</script>
<script>
Show_Banner(2);
</script>
|
| |
|
|
|