PDA

View Full Version : Sharing components between MVC apps



Mike Stoddart
2 Nov 2012, 8:44 AM
I'm trying to understand MVC and how an app might relate to my product. My website has several sub-applications and if I equate one of them to an MVC app, how do I share components between apps? Either in code or using Architect?

For example, the following code is from an example somewhere:

stores: [ 'Users'
],
models: [
'User'
],
views: [
'user.List',
'user.Add',
'user.Edit'
],

This assume that the User model is relative to the application under the app's models folder. Say the user app has a view that is a grid that lets you browse user account information. How would I re-use this view (panel) in say a separate portal application? Would I reference the model absolutely?

models: [ 'auth.model.User'
],

For example?

Thanks

mitchellsimoens
5 Nov 2012, 6:36 AM
It's all about the namespace and the location of the namespace.

So say you have App1 and App2. You also have a SharedApp namespace. App1 and App2 want to load the classes in the SharedApp namespace so all you have to do then is set a path for SharedApp and require the shared classes you want.