Rovak / KJSencha

Ext-JS / Sencha Touch Integration Module for Zend Framework 2
Other
24 stars 15 forks source link

public directory #25

Closed adloiseau closed 11 years ago

adloiseau commented 11 years ago

Hello,

I need to know, where the /public folder (who contain my ExtJS app) must be placed in the zend skeleton. In the module or outside the module ?

If i take the kjsenchaexample the folder /public is placed outside the module. If i take another application like https://github.com/4orever/prompc_v2.git the folder /public is placed in the module.

In the module.config.php, if i want to use my Ext librairy, what is the best way to define? like this? :

return array( 'kjsencha' => array( 'library_path' => '/public/resources/ext/', 'js' => array( 'ext' => 'ext-all.js', ), 'css' => array( 'ext' => 'resources/css/ext-all-gray.css' ), 'direct' => array( 'modules' => array( 'Poems' => array( 'namespace' => 'Poems\Controller', 'directory' => DIR . '/../src/Poems/Controller', ), ), ) ....

and in my layout.phtml to my module : i have nothing to do ?

Thank you in advance

Rovak commented 11 years ago

Hello adloiseau,

Currently KJSenchaExample has its assets in the /public folder because AssetManager was not available at the time this example was made. The assets will be moved to the module/application/public in a future update and i recommend using the AssetManager module for your own assets.

About the module configuration, it is configured correctly but i do not recommend using controllers as a direct layer, please see the KJSenchaExample for an example configuration and structure.

In your layout.phtml you have to make sure that the ExtJS libraries and helpers are loaded correctly, if you call the functions which are used in the bootstrap then you should be up and running with a working ExtJS page.

adloiseau commented 11 years ago

Thank you for your answers. I don't understand your recommendation about using controllers as a direct layer, can you throw a look to my application ? https://github.com/adloiseau/poems-v3.git

Rovak commented 11 years ago

I recommend NOT using the controllers and create a separate namespace for your Direct requests as demonstrated here

catalinux commented 11 years ago

Let me see if I get it right.

Question: do you see these classes that are in "direct" folder to have only the purpose of exposing calls. For example: a method createEvent on agenda class would just make a call to an agendaservice class method passing all the arguments recieved from the direct call.

Catalin

On 14.02.2013, at 22:59, Roy van Kaathoven notifications@github.com wrote:

I recommend NOT using the controllers and create a separate namespace for your Direct requests as demonstrated here

— Reply to this email directly or view it on GitHub.

adloiseau commented 11 years ago

Rovak, Server side, I have a controller structure (Poems/Controller/Kern/structureController.php) that contains two functions a getList() and save().

Function getList() used to be loaded directly when the application launch but my save() function use the API with the annotation formHandler submit.

Client side, I have a model (structure.js) with a proxy and direct type directFn: Poems.Controller.kern.structureController.getList and a window component (/public/js/poems/view/coreWindows/structureCreate.js ) that uses the API submit (api: {submit: Poems.Controller.kern.structureController.save})

If I understand your recommendation I should have:

a controller structure in the folder /controller with the function save() and a class structure in the folder /direct with the function getList()?

Thank you in advance

Rovak commented 11 years ago

To answer your first question: Yes, i only use them to pass arguments to the service layer.

The second question, i usually put them both in Direct, unless you want to call save() in another situation like an HTML form