Mam taki skrypt:
<?php
$maxLinks = 5;
// Lista linkow
array( 'http://www.costam.pll/', 'anchor' ), array( 'http://www.costam2.pl/', 'anchor2' ) );
{
foreach ( $random AS $value )
{
print '<a href="' . $links[ $value ][0] . '" target="_blank">' . $links[ $value ][1] . '</a><br />'; }
}
else
{
print '<a href="' . $links[ $random ][0] . '" target="_blank">' . $links[ $random ][1] . '</a>'; }
?>
Chciałbym zrobić tak, by zamiast linków w kodzie móc dodawać linki w pliku txt.
Help :')
Albo jak przerobić w ten sam sposób by móc w txt dodawać owy skrypt:
<script type="text/javascript">
// <![CDATA[
Array.prototype
.random
= function(limit
) {
if (typeof limit == 'undefined' || limit < 0) limit = 1;
else if (!limit) limit = this.length;
for (var i
= 0
, source
= this
, target
= new Array(), n
= source
.length
; i
< limit
&& n
> 0; i
++) {
do { var index = Math.random(); } while (index == 1);
index
= Math
.floor(index
* n
); target.push(source[index]);
source[index] = source[--n];
}
return target;
}
document
.write
(new Array(// Tu wpisz kolejne elementy:
'Tekst 1',
'Tekst 2',
'Tekst 3'
// ]]>
</script>
Ten post edytował Xe41 1.02.2010, 14:46:25