Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Use PHP in my widget?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use PHP in my widget?



Kirill,

PHP *is* installed on Macs by default and you absolutely *can* use PHP in your widgets.

Sam,

There are things JavaScript can do that you can't do with PHP (like manipulate the DOM). Conversely, there are things you can do with PHP that you can't with JavaScript (like access the filesystem).

Your access to PHP is solely through the command-line via widget.system calls. You should think through which scripts are responsible for which tasks and program accordingly. Because of the complexity of asynchronous widget.system calls, it probably doesn't make sense to use PHP except where it's really necessary.

For example, my PHP function reference widget (http://tr.im/phpfr) uses widget.system calls to PHP scripts to read the files from a directory containing the PHP documentation and return an array of topics (among other things). You could do the same task using a shell script, AppleScript, and probably even a Java or Objective-C plugin if you really wanted to.

There is heaps of documentation out there on the capabilities of Dashboard widgets. I suggest you take a few minutes to read some of it. Start here:

   http://hurl.ws/4728

Regards,
-Andrew
-----
email@hidden / http://andrew.hedges.name/

On 19/07/2009, at 19/07/09 5:58 AM, Kirill Zinov wrote:

Hello Sam,

I think you can't. PHP is not installed on Mac by default.

Kirill,

Sam Iles wrote:

Hi,

Can I use PHP in my widget? And how?

I guess I would have to change the file extension from html to php, but would this work?

I know that there isn't really anything I can do with PHP that I cant with using the JavaScript, I just like it more is all.

Thanks,

Sam

_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Use PHP in my widget? (From: Sam Iles <email@hidden>)
 >Re: Use PHP in my widget? (From: Kirill Zinov <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.