The Numerator wrote:[color=blue]
> I was just wondering that if it is possible to do almost anything you
> can do in JavaScript in PHP.[/color]
Off the top of my head, I would say no. Because in my opinion, one of
the most important essences of javascript is the dynamic DOM
manipulation, which PHP can not do.
"The Numerator" <alvin4jesus@gm ail.com> wrote in
news:1143685879 .477264.186940@ g10g2000cwb.goo glegroups.com:
[color=blue]
> I was just wondering that if it is possible to do almost anything you
> can do in JavaScript in PHP.[/color]
No.
Javascript is capable of interacting with the DOM in ways that PHP cannot.
Javascript functions are able to be "activated" event handlers whereas PHP
cannot.
web.dev wrote:
[color=blue]
> The Numerator wrote:[color=green]
>> I was just wondering that if it is possible to do almost anything you
>> can do in JavaScript in PHP.[/color]
>
> Off the top of my head, I would say no. Because in my opinion, one
> of the most important essences of javascript is the dynamic DOM
> manipulation, which PHP can not do.[/color]
But it can. You are confusing interface language and object model.
Thomas 'PointedEars' Lahn wrote:[color=blue]
> web.dev wrote:
>[color=green]
>> The Numerator wrote:[color=darkred]
>>> I was just wondering that if it is possible to do almost anything you
>>> can do in JavaScript in PHP.[/color]
>> Off the top of my head, I would say no. Because in my opinion, one
>> of the most important essences of javascript is the dynamic DOM
>> manipulation, which PHP can not do.[/color]
>
> But it can. You are confusing interface language and object model.
>
> <URL:http://php.net/dom>[/color]
Yeah, but JavaScript runs on the client, PHP on the server. In order for
PHP to do anything, the browser has to contact the server and get a
repsonse. How would PHP, running on a server, open a new browser window
on the client's computer?
Steve Chapel wrote:
[color=blue]
> Thomas 'PointedEars' Lahn wrote:[color=green]
>> web.dev wrote:[color=darkred]
>>> The Numerator wrote:
>>>> I was just wondering that if it is possible to do almost anything you
>>>> can do in JavaScript in PHP.
>>> Off the top of my head, I would say no. Because in my opinion, one
>>> of the most important essences of javascript is the dynamic DOM
>>> manipulation, which PHP can not do.[/color]
>>
>> But it can. You are confusing interface language and object model.
>>
>> <URL:http://php.net/dom>[/color]
>
> Yeah, but JavaScript runs on the client, PHP on the server.[/color]
Not necessarily.
[color=blue]
> In order for PHP to do anything, the browser has to contact the server and
> get a repsonse. How would PHP, running on a server, open a new browser
> window on the client's computer?[/color]
The concept and interfaces of the Document Object Model are not restricted
to an HTML UA, nor is opening a window part of the DOM (in the original
sense).
The ultimate answer would be no, taking into account the "everything "
clause:
PHP is executed on the server, before the page is sent back to the
browser. It can interact with databases, it can see the server's
filesystem (within set restrictions), doing file I/O, and do other
things where the server would be involved.
JavaScript is executed in the browser, its context is solely the page
in which it is encoded (with a few exceptions eg windows that it opens,
...), parses the DOM of said page and change various properties of the
browser (show/hide elements of the browser, change status bar text,
move elements on a page continuously etc) which cannot be done via PHP.
Moreover JavaScript can catch, react to and manipulate user actions
(mouse clicked, button pressed, key held down) which PHP cannot have
access to.
Thomas 'PointedEars' Lahn wrote:[color=blue]
> Not necessarily.
>[color=green]
>> In order for PHP to do anything, the browser has to contact the server and
>> get a repsonse. How would PHP, running on a server, open a new browser
>> window on the client's computer?[/color]
>
> The concept and interfaces of the Document Object Model are not restricted
> to an HTML UA, nor is opening a window part of the DOM (in the original
> sense).[/color]
Spock, do you need to be so logical? Think about what the person is
asking. Is he referring to JavaScript on the server? The reasonable
answer, although perhaps not 100% technically correct, is that you can
do things in JavaScript (on the web browser client) that are simply not
possible with PHP (on the web server). One example is opening a window.
"The Numerator" <alvin4jesus@gm ail.com> wrote:
[color=blue]
>I was just wondering that if it is possible to do almost anything you
>can do in JavaScript in PHP.[/color]
Javascript is (nearly always, anyway) run on the client. PHP is run on
the server. That being the case, they do quite different things. There
is a small set of things that can be accomplished from either end.
There are *many* things that can be done client-side but not
server-side, and there are *many* things that can be done server-side
but not client-side.
"Thomas 'PointedEars' Lahn" <PointedEars@we b.de> kirjoitti viestissä
news:1157084.9J vEvOCkv1@Pointe dEars.de...[color=blue]
> AndrewTK wrote:
>[color=green]
> > The ultimate answer would be no, taking into account the "everything "
> > clause:[/color]
>
> Wrong.
>
>
> PointedEars[/color]
Wrong Wrong.
Tim Slattery wrote:
[color=blue]
> "The Numerator" <alvin4jesus@gm ail.com> wrote:[color=green]
>> I was just wondering that if it is possible to do almost anything you
>> can do in JavaScript in PHP.[/color]
>
> Javascript is (nearly always, anyway) run on the client.[/color]
JavaScript, JScript, and other ECMAScript implementations are.
There is no "Javascript ".
[color=blue]
> PHP is run on the server. That being the case, they do quite different
> things.[/color]
PHP can also run without a server.
[color=blue]
> There is a small set of things that can be accomplished from either
> end. There are *many* things that can be done client-side but not
> server-side, and there are *many* things that can be done server-side
> but not client-side.[/color]
Thomas 'PointedEars' Lahn wrote:
[color=blue]
> AndrewTK wrote:[/color]
[color=blue][color=green]
>> The ultimate answer would be no, taking into account the "everything "
>> clause:[/color][/color]
[color=blue]
> Wrong.[/color]
[color=blue]
> PointedEars[/color]
Obivously PointedEars has seems to think that SSJS could pop a window on a
client from server-side javascript. So far, I have not found it in the
docs. PE, can you provide documentation and a working example of where
you have actually done this?
Server-Side Java Script (SSJS) docs can be found at:
Thomas 'PointedEars' Lahn wrote:
[color=blue]
> Tim Slattery wrote:[/color]
[color=blue][color=green]
>> "The Numerator" <alvin4jesus@gm ail.com> wrote:[color=darkred]
>>> I was just wondering that if it is possible to do almost anything you
>>> can do in JavaScript in PHP.[/color]
>>
>> Javascript is (nearly always, anyway) run on the client.[/color][/color]
[color=blue]
> JavaScript, JScript, and other ECMAScript implementations are.
> There is no "Javascript ".[/color]
[color=blue][color=green]
>> PHP is run on the server. That being the case, they do quite different
>> things.[/color][/color]
[color=blue]
> PHP can also run without a server.[/color]
That would be false. you cannot -
start a browser
connect to a remote http(s) service
which responds with content
then have that content interact and execute a local PHP script.
If PHP is interactively (or via a cron job etc...) running, the box on
which it is running would be considered a server for that "applicatio n". I
think you are confusing client-server paradigm vs. a server paradigm.
PHP or even the remote server itself does not/cannot know that PHP is even
running on our "client". And even if it could, that would be a HUGE
security risk - which is why it cannot be done.
PHP is a scripting language. It does work and sends a response to stdout.
Where, in the context of a web server, stdout is the connection to a
remote browser. In the context of a terminal session (or CMD prompt et.
al.) stdout can be redirected to an output file or to the "terminal
session". Typing the command "php file.php" (or whatever) means that you
are executing it on this box. It does not interact with PHP on a remote
box - therefore it is server only.
[color=blue][color=green]
>> There is a small set of things that can be accomplished from either
>> end. There are *many* things that can be done client-side but not
>> server-side, and there are *many* things that can be done server-side
>> but not client-side.[/color][/color]
[color=blue]
> True.[/color]
Comment