Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

Widget integration with a locally run php/mysql bundle

Author Message
jrossol



Joined: 02 May 2005
Posts: 1
Location: Ohio

Posted: Mon May 02, 2005 - 5:48 pm    Post subject: Widget integration with a locally run php/mysql bundle Reply with quote

Hello all, this is my first post. I currently do alot of work with PHP, MYSQL and Flash Actionscript. Naturally, I love the interactivity of flash and want to develop for dashboard.

Would it be plausible or even possible to build special widgits for people with a local db and php running? Could you store and call information from a mysql database or use a PHP script to get information off the web? Can you use php in widgits? I had not seen this topic on the boards, so I though I'd throw it out and get some discussion going.

Also, I was reading about initiating web plugins. Can anyone think of any particular use of flash that would be incredibly useful as opposed to just using javascript?
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
collin



Joined: 02 May 2005
Posts: 17

Posted: Tue May 03, 2005 - 2:06 am    Post subject: Reply with quote

I know that you can use PHP from a widget using widget.system calls to php -r, but I'm not sure about MySQL. I would think the user would have to install MySQL to be able to use it.

I believe you can make use of the built-in SQLite, but I'm not sure where I got that idea...
View user's profile Send private message Widgets
jtm



Joined: 03 May 2005
Posts: 4

Posted: Tue May 03, 2005 - 2:13 am    Post subject: Re: Widget integration with a locally run php/mysql bundle Reply with quote

jrossol wrote:
Would it be plausible or even possible to build special widgits for people with a local db and php running? Could you store and call information from a mysql database or use a PHP script to get information off the web?

Sure is... I did this last night, as a matter of fact.

Quote:
Can you use php in widgits?

PHP is a server side technology, whereas Widgets are client side. But your Widget's Javascript code can connect to any web page and fetch XML data - and that data can be generated by a PHP page that is querying a SQL db. Local or live, it doesn't matter where the server is.

As the previous poster mentioned, his way might be something worth checking into. I didn't even go that way because I wanted to write (the PHP) code that generated the XML once, so I could learn how to do it and reuse it in the future for other things besides that widget.

I also read there are easier ways if all you want to do is use a WebView to display a page that it pulls from a server. I couldn't find much documentation on it though, so I bit the bullet and learned 1000% more by digging into the xml request methodology.

Quote:
Also, I was reading about initiating web plugins. Can anyone think of any particular use of flash that would be incredibly useful as opposed to just using javascript?

Personally, I like Flash executables because it is cross-platform and fairly powerful. (On the other hand, the dev environment workflow is bad by 80's standards and the bugs don't help either.) You can make a very nice app using Flash and Actionscript and run it on practically any platform. Besides just putting your swf on a web page, you can built a custom Cocoa app using a WebView - or Widget - plop in your .swf and it will work just like it would in any other browser - literally in minutes. Developing in Cocoa is amazing already, but creating internet/web apps is absolutely amazing.

jtm
View user's profile Send private message Widgets
collin



Joined: 02 May 2005
Posts: 17

Posted: Tue May 03, 2005 - 2:19 am    Post subject: Re: Widget integration with a locally run php/mysql bundle Reply with quote

jtm wrote:
Quote:
Can you use php in widgits?

No. PHP is a server side technology, whereas Widgets are client side. But your Widget's Javascript code can connect to any web page and fetch XML data - and that data can be generated by a PHP page that is querying a SQL db. Local or live, it doesn't matter where the server is.


You can use PHP in your widgets since OS X comes with it, and you can call it from the command line. You'll have to retrieve the data asynchronously, though, as I learned in another thread here.
View user's profile Send private message Widgets
jtm



Joined: 03 May 2005
Posts: 4

Posted: Tue May 03, 2005 - 2:25 am    Post subject: Re: Widget integration with a locally run php/mysql bundle Reply with quote

collin wrote:
jtm wrote:
Quote:
Can you use php in widgits?

No. PHP is a server side technology.

You can use PHP in your widgets since OS X comes with it, and you can call it from the command line. You'll have to retrieve the data asynchronously, though, as I learned in another thread here.

Yeah, I thought about it was I was writing that message, hit submit instead of preview, wanted to edit it anyways but saw your post... then edited mine as fast as possible. Smile

Thanks for correcting and clarifying,
jtm
View user's profile Send private message Widgets
collin



Joined: 02 May 2005
Posts: 17

Posted: Tue May 03, 2005 - 2:31 am    Post subject: Reply with quote

How would you handle the MySQL part, though? It's not installed by default, so you'd have to set all that up yourself, correct?
View user's profile Send private message Widgets
jtm



Joined: 03 May 2005
Posts: 4

Posted: Tue May 03, 2005 - 4:22 am    Post subject: Reply with quote

collin wrote:
How would you handle the MySQL part, though? It's not installed by default, so you'd have to set all that up yourself, correct?


Yes. It's fairly straightforward, but the first time can be tricky.

jtm
View user's profile Send private message Widgets
collin



Joined: 02 May 2005
Posts: 17

Posted: Tue May 03, 2005 - 4:27 am    Post subject: Reply with quote

jtm wrote:
Yes. It's fairly straightforward, but the first time can be tricky.


What about SQLite? Or can you make use of Core Data at all?
View user's profile Send private message Widgets
jtm



Joined: 03 May 2005
Posts: 4

Posted: Tue May 03, 2005 - 11:59 pm    Post subject: Reply with quote

Quote:
What about SQLite? Or can you make use of Core Data at all?


You can write and call your own Cocoa apps just like any other binary on the system, so I can't see why there would be any problem using CoreData.

I don't know much about SQLite beyond the CoreData talk I attended last year. That hour actually caused me to halt development on a few apps until I could re-engineer them using CoreData. Of course, I gotta play with Widgets first!
Smile

jtm
View user's profile Send private message Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group