Extjs projects binding at runtime - model-view-controller

I have three different Extjs projects, all the three using MVC architecture. Out of these three one is going to be common to the other two projects. I would want the common project to be controlling and deciding which project to be loaded. But however I also want to separate the project codes and not have them binded together in a single project. is it possible ? if so how ?
Change:
In Simple Words how can i access few js files in extjs which is not inside the app folder.

We can use the Paths{} attribute inside Ext.loader to set a different path apart from the app path to access files outside app folder. The appFolder attribute of app.js is set to app by default. You can also change that to map a different app path. You can verify these in Sencha Docs.

Related

Building CMS on top of CodeIgniter

Is it possible to build a CMS on top of CodeIgniter where the CMS files is separate from customization files? What I mean is, like CodeIgniter by default comes with 2 main folder, application and system folder. So, all your own files is placed in application folder so that next time you can easily update CodeIgniter by overriding the system folder and everything will still working fine.
So, can I store my files at custom folder?
E.g.:
system folder - codeigniter
my_system folder - CMS
application folder - All customization on each individual projects
You may use CodeIgniter's native application "Package", you can find the doc here : http://ellislab.com/codeigniter/user-guide/libraries/loader.html
You can store your file where you want expect system folder as you written. best approach is make folder on root named public or you want and put your file.
system folder contains everything codeigniter needs. application folder contains your specific code - it defaults to showing the welcome page.
consider naming your system folder with the codeigniter version number and date
makes it easier when you are upgrading
and you can easily switch to different versions directly from the index.php page by editing the file path to the folders

MVC 4 Web API Template - what can be deleted

Using VS2010, creating a new MVC 4 Web API project. Just wondering, can the .js-files in the Script folder be deleted, or are they somehow related to the magic beneath? How about those cshtml- files in the Views folder, I can't see that they are necessary for a REST-service, or again, are they part of the underlying technology. My guess, it can all be deleted safely - but just to be sure...
Bonus question (while I'm here): recommendations for unit- and integrationtesting REST-services, got any?
Thank you.
If your project only exposes a series of WebAPI controllers then that implies that your project will never serve actual HTML-based content. Thus, you can safely delete all files related to that content, such as:
HTML files (.cshtml)
JavaScript files (.js)
CSS style sheets (.css)
Images (.jpg, .png, .gif)

MEF + MVC3 - Showing view always fail

I'm trying to use MEF + MVC3.
I have 2 projects. One where I should "dynamically" render the other modules and I call it Shell. The second project is where I have a certain module, that I want to load inside Shell.
I was able to dynamically instantiate one controller from the module, using MEF, but everytime it redirects to the View it fails to find it.
Do I have to "copy+paste" the Views from all my modules/plugins to my Shell? Or there is any other solution?
You need to copy the .cshtml (or .aspx) view files to the actual application directory.
Views are not compiled into projects; instead, they are read from the web application directory at runtime.
If you want to, you can make your own VirtualPathProvider that reads views from something else.
If you are using .aspx files then you need to make them an embedded view.

ASP.NET MVC3 project does not always publish all views/content

This is crazy, but I can't seem to get all my views/content/scripts published when I publish the site. This seems to happen, I believe, when the view or content is not directly referenced by my project, but used by another assembly in my project. So I might have:
ExternalAssembly.dll referenced (it gets published)
I'll need ExternalLogin.cshtml in my main project, under my views folder
ExternalLogin.cshtml doesn't get published
Right now I have a script that copies everything in the Views folder and dumps it to where I want it deployed, but VS should do this for me. What am I doing wrong?
When you click on one if these files what is the build action for it on the properties? Content....or? Set to content.
So your views files are in another project or folder outside your current project? Normally the files have to exist in the web site project, in it's views folder, not externally, and the build action should be set to Content and not to copy to the output folder. But there are some workarounds:
Duplicate them in to your site views folder and make sure they are marked content (as stated in another answer). One thing to note though is that you can add them as "Linked Files" in visual studio which actually allows them to exist in two places in the hierarchy without having to exist in two places on disk: http://support.microsoft.com/kb/306234
If you have control over the external library, you can compile them in as embedded resources or use Razor Generator or something similar and use a custom view engine to return them: How can I make ASP.NET MVC 3 use views (aspx, ascx) files from an external assembly in my website?
Manually put the copies in the .csproj build XML using the Copy task: http://msdn.microsoft.com/en-us/library/3e54c37h.aspx (Note that this will make it work in visual studio doing essentially what you are doing now, as it will then be part of the Visual Studio build if you add it to the AfterBuild target or something)

Mobile and desktop web app with codeigniter

I want to build two versions of my project for mobile and desktop.
Am working codeigniter 2.0.2, am looking for a way for the mobile and desktop versions of the project to share the same model, controllers, libraries, and helpers.
Also i have set up a sub-domain,m.xyz.com to point to folder called "m" on public_html folder,
i want the the mobile to be in the "m" folder and share resources with the desktop app residing in root so i dont create duplicate models, controllers etc.
CodeIgniter allows you to specify the folder that you are loading your views from. Since you want to reuse all of your application code, simply set up CodeIgniter so that it is loading mobile optimized views rather than the default (desktop) views.
Copy the root index.php file into the /m/ folder that you created.
Update the $system_path and $application_folder variables in /m/index.php with the correct paths.
Update the $view_folder variable in /m/index.php with the path to your view folder containing your mobile optimized views.
You mobile site will now mirror your desktop site - it will just be pulling in different views.
Note that the structure of your mobile views folder will need to mirror the structure of your default views folder.
EDIT: The $view_folder option will not be available until version 2.1. Here is the code if you wish to make the change yourself:
https://github.com/EllisLab/CodeIgniter/commit/8eef9c77512d4fad5357d3cbda83b89f844d7d16

Resources