From: Ashley Sheridan on
On Sat, 2010-08-14 at 01:57 -0500, Karl DeSaulniers wrote:

> That is what I thought.
> Thank you for confirming.
>
> Karl
>
>
> On Aug 14, 2010, at 1:54 AM, Peter Lind wrote:
>
> > On 14 August 2010 08:08, Karl DeSaulniers <karl(a)designdrumm.com>
> > wrote:
> >> Hello all,
> >> I was wondering, can you reference php in a url string like you can
> >> javascript.
> >> EG:
> >> "javascript:someFunction()"
> >>
> >> Can you do something similar in php like
> >>
> >> "php:someFunction()"
> >>
> >> I am thinking that you can not do this, but was wondering if there
> >> was
> >> something like that.
> >> Thanks,
> >
> > No, you can't.
> >
> > Regards
> > Peter
> >
> > --
> > <hype>
> > WWW: http://plphp.dk / http://plind.dk
> > LinkedIn: http://www.linkedin.com/in/plind
> > BeWelcome/Couchsurfing: Fake51
> > Twitter: http://twitter.com/kafe15
> > </hype>
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>


The reason you can't is because PHP is on the server and Javascript is
local (e.g. the browser).

Even if the PHP code you're executing is through localhost, because PHP
needs the server to run, it has to be run on the server, and exposing
functions directly like this would expose all sorts of security issues
(imagine calling up a getUserDetails() on a website you're not logged
into for example, which would mean every function of a system would need
some sort of user auth check and would slow the whole thing to a crawl)

Thanks,
Ash
http://www.ashleysheridan.co.uk


From: Karl DeSaulniers on

On Aug 14, 2010, at 5:19 AM, Ashley Sheridan wrote:

> On Sat, 2010-08-14 at 01:57 -0500, Karl DeSaulniers wrote:
>>
>> That is what I thought.
>> Thank you for confirming.
>>
>> Karl
>>
>>
>> On Aug 14, 2010, at 1:54 AM, Peter Lind wrote:
>>
>> > On 14 August 2010 08:08, Karl DeSaulniers <karl(a)designdrumm.com>
>> > wrote:
>> >> Hello all,
>> >> I was wondering, can you reference php in a url string like you
>> can
>> >> javascript.
>> >> EG:
>> >> "javascript:someFunction()"
>> >>
>> >> Can you do something similar in php like
>> >>
>> >> "php:someFunction()"
>> >>
>> >> I am thinking that you can not do this, but was wondering if there
>> >> was
>> >> something like that.
>> >> Thanks,
>> >
>> > No, you can't.
>> >
>> > Regards
>> > Peter
>> >
>> > --
>> > <hype>
>> > WWW: http://plphp.dk / http://plind.dk
>> > LinkedIn: http://www.linkedin.com/in/plind
>> > BeWelcome/Couchsurfing: Fake51
>> > Twitter: http://twitter.com/kafe15
>> > </hype>
>>
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
>>
>>
>
> The reason you can't is because PHP is on the server and Javascript
> is local (e.g. the browser).
>
> Even if the PHP code you're executing is through localhost, because
> PHP needs the server to run, it has to be run on the server, and
> exposing functions directly like this would expose all sorts of
> security issues (imagine calling up a getUserDetails() on a website
> you're not logged into for example, which would mean every function
> of a system would need some sort of user auth check and would slow
> the whole thing to a crawl)
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>


I see. Very good point. Thanks Ash.
I figured it was because of the whole pre-processing part of PHP.
Thanks for the explination.
Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com

From: tedd on
At 1:08 AM -0500 8/14/10, Karl DeSaulniers wrote:
>Hello all,
>I was wondering, can you reference php in a url string like you can
>javascript.
>EG:
>"javascript:someFunction()"
>
>Can you do something similar in php like
>
>"php:someFunction()"
>
>I am thinking that you can not do this, but was wondering if there
>was something like that.
>Thanks,

Karl:

As others have answered, no php doesn't work that way.

However, you can still send/receive strings through a url via a
$_GET) and direct the actions of a receiving php script and you can
do the same thing via a $_POST.

As such, a "php:someFunction()" could be a:

url?php=someFunction

Where the receiving script takes the command and runs someFunction().

However, I would shorten it a bit and say

url?php=18

Where php would be the command to run a function and 18 would be the
function you want to run.

So, while you can't use the same syntax as javascript, you can get
the same performance.

Cheers,

tedd


--
-------
http://sperling.com/
From: Karl DeSaulniers on
Thanks tedd.


On Aug 14, 2010, at 7:45 AM, tedd wrote:

> At 1:08 AM -0500 8/14/10, Karl DeSaulniers wrote:
>> Hello all,
>> I was wondering, can you reference php in a url string like you
>> can javascript.
>> EG:
>> "javascript:someFunction()"
>>
>> Can you do something similar in php like
>>
>> "php:someFunction()"
>>
>> I am thinking that you can not do this, but was wondering if there
>> was something like that.
>> Thanks,
>
> Karl:
>
> As others have answered, no php doesn't work that way.
>
> However, you can still send/receive strings through a url via a
> $_GET) and direct the actions of a receiving php script and you can
> do the same thing via a $_POST.
>
> As such, a "php:someFunction()" could be a:
>
> url?php=someFunction
>
> Where the receiving script takes the command and runs someFunction().
>
> However, I would shorten it a bit and say
>
> url?php=18
>
> Where php would be the command to run a function and 18 would be
> the function you want to run.
>
> So, while you can't use the same syntax as javascript, you can get
> the same performance.
>
> Cheers,
>
> tedd
>
>
> --
> -------
> http://sperling.com/

Karl DeSaulniers
Design Drumm
http://designdrumm.com