<<-getting started->>all the packages in zephyr resides on "packages" folder. so if you want to develop a new package, just give it a name and create a folder in this folder as "packagename". let me explaint it a bit more. here is the folder structure - zephyr after creating you package, you can create your package definition which is just a small xml file decribes your package. zephyr depend on this package definition to find which template it would run as a home page and which other files are bound to this packages, specially javascript, css and custom php functions. we will discuss about managing packages later. for now, just see a sample package definition. <?xml version="1.0" encoding="iso-8859-1"?> well, i am not going to cover them in detail, just FYI, the "<root_action>" is the first action that will be executed when someone requested a package. this is something similar to your package "homepage". you will get a complete definition under "package definition reference" section <<-the classic "hello world" application->>this is a small ajax application which says "hello world" in any desired <div> in the current page. frst create a golder name "hello_world" under packages folder. - zephyr now start creating the package definition. here is the sample file. <?xml version="1.0" encoding="iso-8859-1"?> now create two seperate folde in your "hello_world". one of them is "actions" which contains all the action necessary for your package, second is "views" which contains the viewes [or templates to render]. lets see the folder structure for your first application. - zephyr now we will create our first action "home" which will be executed as a default action. this action will return the template "hello.tpl" to our controller. zephyrcontroller will then render this template file and display output. <?
now we have to create two template file. one is "hello.tpl" as package homepage and another is a "messages.tpl" for rendering the message and return to your action. lets see the "hello.tpl"...
this file has one <div> object in which our message "hello world" will be loaded dynamically. look at the button, it calls a builtin function "load_action_smartly()". when someone clicked on this button, the action "display_message" will be invoked with one additional parameter message, here it is "Hello World". the third parameter is the name of <div> object in which the result of "display_message" action will be shown dynamically. lets create the action "display_message".
<?
well this is a typical action handler. here out incoming data "hello world" has been passed as "$params". we capture it and pass to "messages.tpl" via this line. $data = array("message"=>$this->params); so the "messages.tpl" will be invoked automatically with smarty variable {$message} as we defined in data array. lets have a look at "messages.tpl". {$message} lets look at the directory structure finally. - zephyr now run your application with following url http://localhost/zephyr/index.php?package=hello_world here are the screenshots |