iwant to add java script to SSI.php

Started by muayzing, May 01, 2004, 07:56:21 AM

Previous topic - Next topic

muayzing

how can i add this java script to the SSI.php
with whosonline_function

<script language="JavaScript1.2">
var variableslide=new Array()

variableslide[0]=['user1]
variableslide[1]=['user2']
variableslide[2]=['user3']
variableslide[3]=[user4']
variableslide[4]=[user5']
variableslide[5]=[' ... ']


//configure the below 3 variables to set the dimension/background color of the slideshow

var slidewidth=''
var slideheight=''
var slidebgcolor=''

//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=1500

////Do not edit pass this line////////////////

var ie=document.all
var dom=document.getElementById
var currentslide=0

function rotatelink(){
contentcontainer=''
if (variableslide[currentslide][0]!="")
contentcontainer+='???????? [<a href="http://'
contentcontainer+=variableslide[currentslide][0]
contentcontainer+='.storythai.com" target=_blank>'
contentcontainer+=variableslide[currentslide][0]
contentcontainer+='</a>]'

if (document.layers){
crossrotateobj.document.write(contentcontainer)
crossrotateobj.document.close()
}
else if (ie||dom)
crossrotateobj.innerHTML=contentcontainer
if (currentslide==variableslide.length-1) currentslide=0
else currentslide++
setTimeout("rotatelink()",slidedelay)
}

if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>')

function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub
if (document.layers)
document.slidensmain.visibility="show"
rotatelink()
}

if (ie||dom)
start_slider()
else if (document.layers)
window.onload=start_slider

</script>


to show useroline like this

hxxp:www.storythai.com/web/useronline.php [nonactive]

[Unknown]



[Unknown]

If you use ssi_whosOnline('array'), you'll get an array... in there, $return['users'] will be a list of users.

Basically, what you'd want to do is this:

<?php
require('SSI.php');

$return ssi_whosOnline('array');

$i 0;
foreach (
$return['users'] as $user)
   echo 
'
variableslide['
$i'] = "'$user['link'], '"';

?>


You won't need to change SSI.php at all.

-[Unknown]

muayzing

#4
it's not work

i try this

<?php
require('SSI.php');
?>
<html>
<body>

<script language="JavaScript1.2">
var variableslide=new Array()

<?php
$return = ssi_whosOnline('array');

$i = 0;
foreach ($return['users'] as $user)
   echo '
variableslide[', $i, ']=[\'', $user['link'], '\']<br>';

?>


var slidewidth=''
var slideheight=''
var slidebgcolor=''

...


but it's not work. i see the blank page
no anything ...

then

only this

<?php
$return = ssi_whosOnline('array');

$i = 0;
foreach ($return['users'] as $user)
   echo '
variableslide[', $i, ']=[\'', $user['link'], '\']<br>';

?>


without the javascripts
its show

variableslide[0]=['user1']
variableslide[0]=['user2']
variableslide[0]=['user3']
variableslide[0]=['user...']


i think cause of the number

  • it should be

    variableslide[0]=['user1']
    variableslide[1]=['user2']
    variableslide[2]=['user3']
    variableslide[3]=['user...']



    then i try to put to the script


    <script language="JavaScript1.2">
    var variableslide=new Array()

    variableslide[0]=['user1']
    variableslide[1]=['user2']
    variableslide[2]=['user3']
    variableslide[3]=['user...']


    var slidewidth=''
    var slideheight=''
    var slidebgcolor=''



    the scripts work to show but not change user...


    but with the php in the java scripts


    <script language="JavaScript1.2">
    var variableslide=new Array()

    <?php
    $return = ssi_whosOnline('array');

    $i = 0;
    foreach ($return['users'] as $user)
       echo '
    variableslide[', $i, ']=[\'', $user['link'], '\']<br>';

    ?>


    var slidewidth=''
    var slideheight=''
    var slidebgcolor=''

    ...



    its show blank page
    ? ? ?


    Mmm sorry for my bad english

muayzing

sorry
i should be

variableslide[0]=['user1']
variableslide[0]=['user2']
variableslide[0]=['user3']
variableslide[0]=['user...']

[Unknown]

Sorry, I made a small typo.

<?php
require('SSI.php');

$return ssi_whosOnline('array');

$i 0;
foreach (
$return['users'] as $user)
   echo 
'
variableslide['
$i++, '] = "'$user['link'], '"';

?>


-[Unknown]

muayzing

wow
it works

thak you very much unknow

:)

Webby


dracomiconia2

As newbie user... I only can say... ¡Great!

dracomiconia

#10
I dont make it works....

Must be I'm sleepy, but I dont know to make the call to the script...

After the require....



<script language="JavaScript1.2">
var variableslide=new Array()
<?php
$return 
ssi_whosOnline('array');
$i 0;
foreach (
$return['users'] as $user)
echo 
'
variableslide['
$i++, '] = "'$user['link'], '"';
?>

//configure the below 3 variables to set the dimension/background color of the slideshow
var slidewidth=''
var slideheight=''
var slidebgcolor=''
//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=1500
////Do not edit pass this line////////////////
var ie=document.all
var dom=document.getElementById
var currentslide=0
function rotatelink(){
contentcontainer=''
if (variableslide[currentslide][0]!="")
contentcontainer+='???????? [<a href="http://'
contentcontainer+=variableslide[currentslide][0]
contentcontainer+='.storythai.com" target=_blank>'
contentcontainer+=variableslide[currentslide][0]
contentcontainer+='</a>]'
if (document.layers){
crossrotateobj.document.write(contentcontainer)
crossrotateobj.document.close()
}
else if (ie||dom)
crossrotateobj.innerHTML=contentcontainer
if (currentslide==variableslide.length-1) currentslide=0
else currentslide++
setTimeout("rotatelink()",slidedelay)
}

if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>')

function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub
if (document.layers)
document.slidensmain.visibility="show"
rotatelink()
}

if (ie||dom)
start_slider()
else if (document.layers)
window.onload=start_slider
</script>



And after this....

Advertisement: