PDA

View Full Version : Different App directory For different pages or use the same directory structure



actualeyes
19 Dec 2011, 4:44 PM
I am currently converting a page to the new MVC architecture. I am wondering the best practice for different pages. The MVC tutorial has a top namespace that refers to that one page. Does that mean that I should create a new MVC directory structure for each different page or can I use the same directories. If it is the latter, how do I deal with namespace issues when I want to reuse components from a different page.

Thanks,

Actualeyes

mitchellsimoens
20 Dec 2011, 5:07 AM
This is more about code organization as the filesystem should follow your class names exactly (case sensitive).

Lets say we are making an email program with an email list screen, a contact list screen and a compose screen. You could organize your code like this (class names):

Email.view.email.List
Email.view.contact.List
Email.view.compose.Form

Then your filesystem for these would be like:

/app
--/view
----/compose
------Form.js
----/contact
------List.js
----/email
------List.js

actualeyes
20 Dec 2011, 12:02 PM
Actually it's a bit different of a problem. So the source files are mapped to servername/static. However, I am getting 404s because the library files are being requested at the servername/beta/advertiser/ which is the root of this particular application. How do I get the libraries to be requested at servername/static?

Thanks again,

Actualeyes

actualeyes
21 Dec 2011, 2:59 PM
Okay, I have been looking at this problem a little more and can articulate it better. My problem is that my libraries do not map to a subdirectory of the url that is called.

So if I have the url mapped to /x/y/z/application,
but my static files are mapped to /static/x/y/z/application how can I get the libraries included.

It appears that ExtJS just assumes that my javascript files are mapped to a subdirectory of the outward url. . .

-Actualeyes

skirtle
22 Dec 2011, 11:06 PM
If I've understood your question correctly, perhaps these might help?

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Loader-method-setConfig
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Loader-method-setPath

You can use them to specify exactly which URL (absolute or relative) is the root URL for a particular package.