View Full Version : Coding for YUI/YUI-EXT in PHP

26 Nov 2006, 12:54 AM
I am in the process of writing a fairly complex PHP app for in house use. At this stage it's mostly straight HTML/CSS, with a little Ajax - but I plan to rebuild the interface with Layout and other YUI/YUI-EXT tools (treeview, dialogs and grid immediately spring to mind).

I am a fairly experienced PHP prorgrammer, but fairly novice with JS (especially the OOP approach in YUI) - I'm looking for some pointers on the practicality of using PHP in conjunction with these tools.

I'm assuming I will need to adapt my backend code to serve mainly XML (or JSON?) and create frontends more with the JS stucture offered by YUI.

Alternatively I considered using PHP to generate the JS, but that seems likely to be a waste of time and effort.

I'm not sure what my questions really are, as I haven't got that far into planning this part of development - but I'd love some links to some grassroots examples to using YUI with PHP logic on the serverside. I've managed to make a paged grid so far, and do a basic Ajax GET operation.

I guess any pointers anyone might have to offer would be good.

I really need to learn about tying parts of the layout together (so that menu options in the 'East' window will load new data into the main window, etc). And practical Ajax usage for things like updating form content (I have to build a filepicker for example).

Any pointers gratefully accepted.


26 Nov 2006, 5:12 AM
There are a few routes you can take.

1. The classic route. Generate everything on the server (including JS) and send out the blob.

2. The extreme route. Generate everything on the client and only fetch json/xml data from the server.

3. A mix of the two. Generate a shell on the server, but generate specific views on the client with json/xml data coming from php.

My preference is 3. Generate what you can/should on the server and individual views on the client. This approach leaves php as a data access, validation and storage service.