Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 02-04-2005, 16:00   #8 (permalink)
Dave Patton
Civilians

 
Default Re: Allowing a script to run only once...

"plato" <platoTAKETHISOUT@telpacific.com.au> wrote in
news:42036279@news.rivernet.com.au:

> My site is predominantly php...photo gallery... and the index page
> displays thumbs ( at random) from each of the 20 galleries. When
> people click on a gallery they go to that gallery to look at paintings
> and ultimately come back to Home which is the index page.
>
> I want to run a javascript on the index page that will only run when
> they arrive at the site, not again when they return to the index
> page... can someone tell me how I accomplish this.


PHP questions would best be asked in a PHP newsgroup ;-)

When http://www.example.com/index.php is requested,
it checks for the existance of a session variable
(e.g. "been_here_already"). If it exists, the PHP
script generates the page, without the javascript.
If the "been_here_already" session variable does
not exist, then create it, and generate the page,
including the javascript. You'll have to pay
attention to caching issues.

Of course that is predicated on sessions, so it depends
on what you mean by "arrive at the site".

And, as you should never be reliant on javascript anyway,
why not just have the PHP script do whatever it is you
want to do with the javascript.

--
Dave Patton
Canadian Coordinator, Degree Confluence Project
http://www.confluence.org/
My website: http://members.shaw.ca/davepatton/
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-04-2005, 16:00   #9 (permalink)
plato
Civilians

 
Default Re: Allowing a script to run only once...


"Gerry for email use my name at dergal dt com" <sales@exleaseit.co.uk> wrote
in message news:Q8KMd.288$V84.246@newsfe3-win.ntli.net...
> plato wrote:
> > My site is predominantly php...photo gallery... and the index page

displays
> > thumbs ( at random) from each of the 20 galleries. When people click on

a
> > gallery they go to that gallery to look at paintings and ultimately come
> > back to Home which is the index page.
> >
> > I want to run a javascript on the index page that will only run when

they
> > arrive at the site, not again when they return to the index page... can
> > someone tell me how I accomplish this.
> >
> > cheers
> >
> > Plato
> >
> >

> Completely honestly - you can't ...
>
> However by checking against IP addresses, or cookies you sort of can -
> i.e. create a cookie, Alternatively - could all your "homepage" links be
> a different homepage?
>
> G


Thanks Gerry, no unfortunately the homepage links need to be same...I was
thinking along the cookie lines but have created one of those yet...
thanks
plato


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-04-2005, 20:00   #10 (permalink)
Toby Inkster
Civilians

 
Default Re: Allowing a script to run only once...

plato wrote:

> I want to run a javascript on the index page that will only run when they
> arrive at the site, not again when they return to the index page... can
> someone tell me how I accomplish this.


Javascript should do this:

if (some cookie is not set) {
do your stuff;
set the cookie;
}

Of course, you'll probably want to figure out something to do with people
who have cookies disabled.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
simple setup for allowing visitors to choose their country Nicole Web Design 8 10-25-2005 22:03
DoD Allowing More Wounded Troops to Remain on Duty cato2 DOD News Services 1 10-15-2004 19:59
DoD Allowing More Wounded Troops to Remain on Duty Press Service DOD News Services 0 10-14-2004 22:00
F2 (Refresh) stops allowing me to overwrite after the second character dep397 Microsoft Applications 4 06-16-2004 00:04
Allowing text to overlap other cells Scot Microsoft Applications 2 06-15-2004 16:30


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 04:43.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.84094 seconds with 18 queries