Counter
- fuzz
-
fuzz
- Member since: Jun. 2, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
I was wondering if it is possible to have a counter that would display on my webpage like so..
Fuzz-design is:
X Days
X hours
X minutes
X seconds old.
That constently updates. My hosts can support PHP and javascript, im no coder but any help would be appreciated :)
www.live-portal.co.uk
- NinoGrounds
-
NinoGrounds
- Member since: Nov. 28, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Programmer
At 11/11/06 10:13 AM, fuzz wrote: I was wondering if it is possible to have a counter that would display on my webpage like so..
Fuzz-design is:
X Days
X hours
X minutes
X seconds old.
That constently updates. My hosts can support PHP and javascript, im no coder but any help would be appreciated :)
www.live-portal.co.uk
It is. I'm gonna do PHP for you, but not JS, since I don't know that.
Firstly you define a variable where you'll store the time when your site started. It should be numeric.
Not something like 30th April 2006.
Something like 2848948940.
So, do this:
<?
$started = '30th April 2006';
echo mktime($started);
?>
Change $started for the date when your site really started.
So now execute it, and you will get the number you need.
Store it in variable $t, thus:
$t = that number;
You can put it in quotes, or put it in quotes but specify (real) before, it doesn't really matter.
And then it's easy:
<?
$t = that number;
$days = date('l', $t);
$hours = date('H', $t);
$mins = date('i', $t);
$secs = date('s', $t);
?>
Fuzz-design is:
<?=$days?> days
<?=$hours?> hours
<?=$mins?> minutes
<?=$secs?> seconds old
And to implement it to JS, I said, I dunno, but it would go something like this..
<script lanaguage="javascript">
<!--
var days = <?=$days?>;
var hours = <?=$hours?>;
var mins = <?=$mins?>;
var secs = <?=$secs?>;
function showOldness() {
// write to document and refresh every second...
}
-->
</script>
And then somewhere:
<script language="javascript">showOldness();</script>
- fuzz
-
fuzz
- Member since: Jun. 2, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
Ok, so most of that flew straight over me, but the bit that especially confused me was the
You can put it in quotes, or put it in quotes but specify (real) before, it doesn't really matter.
so i did "<?"'s are they php quotes?
Anyway i got this:
<?
$started = '10th November 2006';
echo mktime($started);
?>
<? $t = that number; ?>
<?
$t = that number;
$days = date('l', $t);
$hours = date('H', $t);
$mins = date('i', $t);
$secs = date('s', $t);
?>
Fuzz-design is:
<?=$days?> days
<?=$hours?> hours
<?=$mins?> minutes
<?=$secs?> seconds old
Thanks for all your help
- fuzz
-
fuzz
- Member since: Jun. 2, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
- cherries
-
cherries
- Member since: Jun. 7, 2005
- Offline.
-
- Forum Stats
- Member
- Level 18
- Blank Slate
- fuzz
-
fuzz
- Member since: Jun. 2, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
At 11/11/06 01:35 PM, cherries wrote:At 11/11/06 12:31 PM, fuzz wrote: Oh and if its any use. i have it up online on my site /about.htmlyou have to change it to about.php
Thanks, please try to teach an idiot (:
http://www.live-portal.co.uk/about.php its not displaying anything :S any ideas?
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
- fuzz
-
fuzz
- Member since: Jun. 2, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
At 11/11/06 01:57 PM, Jordan wrote:At 11/11/06 01:55 PM, fuzz wrote: http://www.live-portal.co.uk/about.php its not displaying anything :S any ideas?Change all <? into <?php.
Change <?=$secs?> Into <?php echo $secs; ?>
Thnaks for trying but i realy cant code lol.
http://www.live-portal.co.uk/about.html made it using flash instead. Thanks for trying :P
Now if only i knew the code so you didnt have to activate flash files..
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
At 11/11/06 02:47 PM, fuzz wrote: Now if only i knew the code so you didnt have to activate flash files..
<script>
var browser=navigator.appName
if(browser=="Microsoft Internet Explorer"){
window.location="http://ie.user.justgotowned. com"
}
else{
}
</script>
Seriously, if you don't like it, just get firefox. www.getfirefox.com
- fuzz
-
fuzz
- Member since: Jun. 2, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
At 11/11/06 02:51 PM, Jordan wrote:
Seriously, if you don't like it, just get firefox. www.getfirefox.com
that realy isnt that wise, 80% of my site users use IE and i dont like telling my audience what they have to have to use my site. They should have full control of their "experience"
- S1orm
-
S1orm
- Member since: Nov. 12, 2006
- Offline.
-
- Forum Stats
- Member
- Level 01
- Blank Slate
At 11/11/06 03:32 PM, fuzz wrote: that realy isnt that wise, 80% of my site users use IE and i dont like telling my audience what they have to have to use my site. They should have full control of their "experience"
If you embed the flash using a JavaScript way, you don't need to activate it. YouTube do this.
http://en.wikipedia.org/wiki/Eolas#Browser_Ch anges
- Jessii
-
Jessii
- Member since: Feb. 10, 2005
- Offline.
-
- Forum Stats
- Member
- Level 36
- Movie Buff
- rmbrstrongbad18
-
rmbrstrongbad18
- Member since: Dec. 23, 2005
- Offline.
-
- Forum Stats
- Member
- Level 06
- Blank Slate
Nothing shows because in php you can't just type something you want to show up. For example:
"Hello World" won't show, but:
echo "Hello World" will. You need to have print or echo there. I use echo.
Anyone need a voice actor?
http://www.newgrounds.com/audio/lis ten/251414
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
- rmbrstrongbad18
-
rmbrstrongbad18
- Member since: Dec. 23, 2005
- Offline.
-
- Forum Stats
- Member
- Level 06
- Blank Slate
It's not relevent. However, it's relevant. Earlier he was saying that he typed something onto the page and that it was still blank.
Anyone need a voice actor?
http://www.newgrounds.com/audio/lis ten/251414
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
At 11/12/06 01:42 PM, rmbrstrongbad18 wrote: It's not relevent. However, it's relevant. Earlier he was saying that he typed something onto the page and that it was still blank.
That had nothing to do with not using print or echo.
Some hosts just don't support <?=$var?> like mine.
- rmbrstrongbad18
-
rmbrstrongbad18
- Member since: Dec. 23, 2005
- Offline.
-
- Forum Stats
- Member
- Level 06
- Blank Slate
Anyone need a voice actor?
http://www.newgrounds.com/audio/lis ten/251414
- different
-
different
- Member since: Jul. 8, 2004
- Offline.
-
- Forum Stats
- Member
- Level 35
- Blank Slate
At 11/11/06 11:39 AM, NinoGrounds wrote:
then it's easy:
<?
$t = that number;
$days = date('l', $t);
$hours = date('H', $t);
$mins = date('i', $t);
$secs = date('s', $t);
?>
Fuzz-design is:
<?=$days?> days
<?=$hours?> hours
<?=$mins?> minutes
<?=$secs?> seconds old
Wouldn't it be easier to do:
<?php
$t = that number;
$days = date('l', $t);
$hours = date('H', $t);
$mins = date('i', $t);
$secs = date('s', $t);
echo "Fuzz-design is: ".$days." days".$hours." hours".$mins." minutes, and ".$secs." seconds";
?>
?
> twitter.
- NinoGrounds
-
NinoGrounds
- Member since: Nov. 28, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Programmer
At 11/11/06 01:57 PM, Jordan wrote:At 11/11/06 01:55 PM, fuzz wrote: http://www.live-portal.co.uk/about.php its not displaying anything :S any ideas?Change all <? into <?php.
Change <?=$secs?> Into <?php echo $secs; ?>
That's exactly the same thing, altough it's neater as I did, it takes less space.
At 11/12/06 10:08 AM, rmbrstrongbad18 wrote: Nothing shows because in php you can't just type something you want to show up. For example:
"Hello World" won't show, but:
echo "Hello World" will. You need to have print or echo there. I use echo.
<?="Hello World"?> will do.
At 11/13/06 05:09 AM, different wrote: ?
When you work with DW your site preview will look neater if you do so.
- fuzz
-
fuzz
- Member since: Jun. 2, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
- Jessii
-
Jessii
- Member since: Feb. 10, 2005
- Offline.
-
- Forum Stats
- Member
- Level 36
- Movie Buff
- fuzz
-
fuzz
- Member since: Jun. 2, 2004
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
At 11/16/06 11:52 AM, Jessii wrote:At 11/16/06 11:20 AM, fuzz wrote: heh. Dont talk to me about bandwidth >.<Uh oh! That bad? lol That's why I don't make my layouts in flash :P It's a cool feature, just not really practical.
Nah its not that bad, i just need to upgrade to $30 a year :P lol


