Re: Re: PHP to replace javascript
| From: | Matthew Weier O'Phinney | Date: | Fri, 03 Sep 2004 20:24:21 +0000 |
| Subject: | Re: Re: PHP to replace javascript | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-195776@lists.php.net to get a copy of this message | ||
* Jack Gates <jack@morningstarcom.net>:
> On Friday 03 September 2004 01:11 am, Sam Hobbs wrote:
> > "Jack Gates" <jack@morningstarcom.net> wrote in message
> > news:200409030020.25759.jack@morningstarcom.net...
> >
> > > Javascript can open a separate and specifically sized window from
> > > a web page when a user clicks on a link that might reference a
> > > note or picture etc.
> > >
> > > Can this be done with PHP? If yes, will someone tell me where in
> > > the manual on the php.net site I can find the information to learn
> > > how to do this?
<snip>
> > I am new to PHP also but there is some fundamental understanding of PHP
> > that is likely to make things much more clear. PHP is a server-side
> > facility. PHP executes before the HTML is (considered to be) complete. Then
> > the HTML is sent to the client.
<snip>
> I knew I had seen a pop up window on a web site that I new was completely
> written in PHP and driven by MySQL. The HTML output was done on the fly by
> the code and database, which prompted my question.
>
> I went to the actual PHP script source since I have direct access to it. The
> picture that was popping up when the link is picked is being done by
> Javascript embedded in the source PHP script.
>
> Now it is a lot clearer that the window pop up can't be done with PHP. If by
> chance my conclusion is wrong some one please enlighten me.
Nope, you've got it right. As a server-side technology, PHP cannot make
changes or affect your browser in any way. Only client-side
technologies such as java/ecmascript can do that.
> My objective here is to remove Javascript from my site every where that I
> possibly can and to replace it with server side code or something else. The
> reason for this is simply because some people are going to turn off
> Javascript from their browser because of the danger that it could pose to
> their local box if they visit a site with evil intent.
Noble intention. I've found, in doing sites for freelance clients and at
work, however, that sometimes javascript effects are what are desired --
little windows for paging through images, popup notes, etc. In these
cases, I put little snippets into the source page: '(action) is
only accessible if javascript is turned on.'
As much as possible, however, I try and do things on the server-side,
particularly where form validation is concerned.
--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org