Re: Counter
| From: | bbonkosk at tampabay dot rr dot com | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Counter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146845@lists.php.net to get a copy of this message | ||
Yes, this could be done in PHP to, but isn't that like using a screwdriver to
pound in a nail? This is clearly a case for client side programming. So
either embedd a nice little java applet that gets a dynamically updated file
via sockets, or do some javascript algorithm that will appear to update while
the user is sitting at your site.
-Brad
> Hi
>
> setup a cron job to write to a file, the number you wish to see.
>
> then, use an <iframe>,
> http://www.w3schools.com/tags/tag_iframe.asp
>
> have the iframe page reload itself every second, reading the new number from
> the file.
>
> when a user loads the page, they will see the counter incrementing every
> second, or whatever period you wish
>
>
> --
> Chris Edwards
> Web Application Developer
> Outer Banks Internet, Inc.
> 252-441-6698
> chris.edwards@obinet.com
> http://www.OuterBanksInternet.com
>
> ----- Original Message -----
> From: "Mark Douglas" <Mark.Douglas@Q9.com>
> To: "'Shaun'" <shaun@mania.plus.com>;
> <php-general@lists.php.net>
> Sent: Thursday, May 08, 2003 9:36 AM
> Subject: RE: [PHP] Counter
>
>
> > If they want to see the counter incrementing while the user is sitting on
> > one page, you're going to have to do something in javascript or another
> > dynamic language. As is stated many times on this list, PHP is server side
> > only and will not make a webpage dynamic at the client side for you.
> >
> > -----Original Message-----
> > From: Shaun [mailto:shaun@mania.plus.com]
> > Sent: Thursday, May 08, 2003 9:31 AM
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] Counter
> >
> >
> > Thanks for your reply mark,
> >
> > but they want to see the counter actually incrementing whilst the user is
> on
> > the site...
> >
> >
> > "Mark Douglas" <Mark.Douglas@Q9.com> wrote in message
> >
>
> news:05924A4A9DEDAD46A21EE3C8C64B090D02B6CDC6@cheetah.zoo.q9networks.com...
> > > I'm not awake enough to provide example code, but something like this
> > should
> > > work:
> > >
> > > - Set a base date
> > > - Set a base counter value
> > > - Get the current date, subtract base date, gives you number of days
> since
> > > start of counter
> > > - multiple number of days since start of counter by 7000
> > > - add this value to base counter value, giving you start of day value
> > > - divide 86400 by 7000 to give number of seconds that needs to pass to
> > > increment value
> > > - count number of seconds that has passed in the day, divide by number o
> f
> > > seconds to increment, giving todays current addition to counter
> > > - add current addition to start of day value
> > >
> > > Voila, you have a piece of code that you can put in a header/footer on
> > every
> > > page and will be different every time a user loads a page. This is
> > asssuming
> > > you're just going on the 7000/day value, and not actually caring about
> the
> > > real number of units sold.
> > >
> > > I hope that didn't confuse too much.
> > >
> > > Mark
> > >
> > > -----Original Message-----
> > > From: Shaun [mailto:shaun@mania.plus.com]
> > > Sent: Thursday, May 08, 2003 9:13 AM
> > > To: php-general@lists.php.net
> > > Subject: [PHP] Counter
> > >
> > >
> > > Hi,
> > >
> > > I have a client who wants a counter on their site showing a number which
> > > rises by 7000 a day and visibly clocks up whilst a user is on the site.
> > This
> > > is meant to show the number of products they sell a a day. I'm just not
> > sure
> > > how this would work though, would i have to store the ammount in a
> > database,
> > > how would it increment whilst no one is one the site.
> > >
> > > Thanks for your help
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>