Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: ''Kiek laiko gyvuoja''

Parašė lajanas· 2010 Kov. 27 18:03:48
#1

Sveikia, maciau nepamenu kuriame saite, bet buvo pvz: Gyvuojame: 2dienas,2valandas,5minutes.
Jai galit numeskit ta skripta ;)


Aciu

Parašė smart· 2010 Kov. 27 18:03:20
#2

Paieška nenori pasinaudot? :)

Parašė lajanas· 2010 Kov. 27 18:03:01
#3

Ieskojau, nezinau kaip rasyti ;D neradau., nes nezinau kaip vadinasi, neisivaizduoju.

Parašė smart· 2010 Kov. 27 18:03:54
#4

"Portalas gyvuoja" parašai ir pilna..

Parašė iSoon· 2010 Kov. 27 19:03:31
#5

openside("Mes gyvuojam");
?>
<style style="text/css">
.dcountstyle{
font: bold 16px Arial;
padding: 3px;
}
.dcountstyle sup{
font-size: 90%
}
</style>
<script type="text/javascript">
function dcountup(startingdate, baseunit){
   this.currentTime=new Date()
   this.startingdate=new Date(startingdate)
   this.timesup=false
   this.baseunit=baseunit
   this.start()
}

dcountup.prototype.oncountup=function(){}
dcountup.prototype.start=function(){
   var thisobj=this
   this.currentTime.setSeconds(this.currentTime.getSeconds()+1)
   var timediff=(this.currentTime-this.startingdate)/1000 //difference btw target date and current date, in seconds
   var oneMinute=60 //minute unit in seconds
   var oneHour=60*60 //hour unit in seconds
   var oneDay=60*60*24 //day unit in seconds
   var dayfield=Math.floor(timediff/oneDay)
   var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour)
   var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute)
   var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute))
   if (this.baseunit=="hours"){ //if base unit is hours, set "hourfield" to be topmost level
      hourfield=dayfield*24+hourfield
      dayfield="n/a"
   }
   else if (this.baseunit=="minutes"){ //if base unit is minutes, set "minutefield" to be topmost level
      minutefield=dayfield*24*60+hourfield*60+minutefield
      dayfield=hourfield="n/a"
   }
   else if (this.baseunit=="seconds"){ //if base unit is seconds, set "secondfield" to be topmost level
      var secondfield=timediff
      dayfield=hourfield=minutefield="n/a"
   }
   var result={days: dayfield, hours:hourfield, minutes:minutefield, seconds:secondfield}
   this.oncountup(result)
   setTimeout(function(){thisobj.start()}, 1000) //update results every second
}

</script>
<div id="cpcontainer">&nbsp;</div>

<script type="text/javascript">

//SYNTAX: myvariable=new dcountup(past_date_and_time_string, "baseunit")
//nurodote savo data, menesi anglu kalba
var princewedding=new dcountup("April 9, 2009 13:30:00", "days")

princewedding.oncountup=function(result){
   //result is an object containing the current count up date/time, updated every second
   //Available properties: result["days"], result["hours"], result["minutes"], and result["seconds"]
   var mycountainer=document.getElementById("cpcontainer")
   mycountainer.innerHTML="Projektas gyvuoja: <br /><span class='dcountstyle'>"+result['days']+" <sup>dienas</sup> "+result['hours']+" <sup>valandas</sup> "+result['minutes']+" <sup>min</sup> "+result['seconds']+" <sup>s</sup></span>"
}

</script>
<?
closeside();





Kitas variantas

openside("Tinklalapis gyvuoja");
$data=dbarray(dbquery("SELECT user_joined FROM ".$db_prefix."users WHERE user_id=1;"));
$atidarytas=$data['user_joined'];
$laikas = time();
$gyvuoja = ($laikas-$atidarytas)/86400;
$dienos = round($gyvuoja);
echo "<center><font size='4' color='blue'><b>$dienos - dienų</b></font>";
closeside();



Redagavo iSoon· 2010 Kov. 27 19:03:43

Parašė switz· 2010 Kov. 27 19:03:59
#6

1.
openside("Tinklalapis gyvuoja");
$data=dbarray(dbquery("SELECT user_joined FROM ".$db_prefix."users WHERE user_id=1;"));
$atidarytas=$data['user_joined'];
$laikas = time();
$gyvuoja = ($laikas-$atidarytas)/86400;
$dienos = round($gyvuoja);
echo "<center><font size='4' color='blue'><b>$dienos - dienų</b></font>";
closeside();




2.
openside("Mes gyvuojam");
?>
<style style="text/css">
.dcountstyle{
font: bold 16px Arial;
padding: 3px;
}
.dcountstyle sup{
font-size: 90%
}
</style>
<script type="text/javascript">
function dcountup(startingdate, baseunit){
   this.currentTime=new Date()
   this.startingdate=new Date(startingdate)
   this.timesup=false
   this.baseunit=baseunit
   this.start()
}

dcountup.prototype.oncountup=function(){}
dcountup.prototype.start=function(){
   var thisobj=this
   this.currentTime.setSeconds(this.currentTime.getSeconds()+1)
   var timediff=(this.currentTime-this.startingdate)/1000 //difference btw target date and current date, in seconds
   var oneMinute=60 //minute unit in seconds
   var oneHour=60*60 //hour unit in seconds
   var oneDay=60*60*24 //day unit in seconds
   var dayfield=Math.floor(timediff/oneDay)
   var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour)
   var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute)
   var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute))
   if (this.baseunit=="hours"){ //if base unit is hours, set "hourfield" to be topmost level
      hourfield=dayfield*24+hourfield
      dayfield="n/a"
   }
   else if (this.baseunit=="minutes"){ //if base unit is minutes, set "minutefield" to be topmost level
      minutefield=dayfield*24*60+hourfield*60+minutefield
      dayfield=hourfield="n/a"
   }
   else if (this.baseunit=="seconds"){ //if base unit is seconds, set "secondfield" to be topmost level
      var secondfield=timediff
      dayfield=hourfield=minutefield="n/a"
   }
   var result={days: dayfield, hours:hourfield, minutes:minutefield, seconds:secondfield}
   this.oncountup(result)
   setTimeout(function(){thisobj.start()}, 1000) //update results every second
}

</script>
<div id="cpcontainer">&nbsp;</div>

<script type="text/javascript">

//SYNTAX: myvariable=new dcountup(past_date_and_time_string, "baseunit")
//nurodote savo data, menesi anglu kalba
var princewedding=new dcountup("April 9, 2009 13:30:00", "days")

princewedding.oncountup=function(result){
   //result is an object containing the current count up date/time, updated every second
   //Available properties: result["days"], result["hours"], result["minutes"], and result["seconds"]
   var mycountainer=document.getElementById("cpcontainer")
   mycountainer.innerHTML="Projektas gyvuoja: <br /><span class='dcountstyle'>"+result['days']+" <sup>dienas</sup> "+result['hours']+" <sup>valandas</sup> "+result['minutes']+" <sup>min</sup> "+result['seconds']+" <sup>s</sup></span>"
}

</script>
<?
closeside();




Jeigu negaila +10 ;)

Redagavo switz· 2010 Kov. 27 19:03:22