model view controller - How to structure Javascript architecture to complement a PHP MVC web app? -


I'm working on a new JavaScript architecture for running a web app. There were so many inline codes in the previous revision, which included scattered, there was no directory structure for .js files and everything was in the global namespace. I'm making the goal: keep the script included in the footer, keep everything in an application name space / object, add the organization to .js files and all applications specific files into a bundle.Design in JS

I am trying to get a modular approach based on nicolas covered: "scalable javascript application architecture"

Site is currently

  / App / models / views / home / auth / meta about.tpl contact.tpl privacy.tpl / controllers home.php auth.php meta.php / public / js core.js / module module files here / jquery jqueryplugins here / controllers Home.js auth.js meta JS  

Controllers have methods that correspond to our URL routing and look at rendering. For example, http: // localhost / meta / contact will call the "contact" function on the "meta" controller and present the meta / contact template.

I'm planning to pass an object global object to an individual initialized call near JS architecture that is logic in terms of controller and method.

  localwebapp.init (Controller, Law);  

At this point in design I am struggling on legacy and module implementation. Some modules will be global and will be used on the entire site, some modules will be used through specific controllers, and some modules will only be on controller functions, the modules are free and will not communicate with each other, giving them a "sandbox "Which they will see for event triggers

I think I should come across sandbox and module classes Will be needed. The administrator script must initially be started as a few lines of modules to be assigned to the sandbox.

I know if I'm amending a wheel here again. Any direction is greatly appreciated I have worked in JavaScript MVC frame like JavaScriptMVC but it seems that I do not need it.

We also use JavaScript MVC. You can use both in one application.

In our case, our application is more front-run and backend side (ZF with MVC) is a REST API and Javascript MVC makes it easy to do so. The feature set is still in the PHP part, and neither client-side, we use lots of javascript MVC so that it looks snapier.

In the end, I have no reason why this may not be why it is in other ways.

I think the wrong impression about the part of watching in MVC is that something like this appears in the browser. Visual XML or JSON can also be. I'm sure you know this, but I wanted to emphasize this part because it is that most people are thrown away.

If you usually ask about JavaScript MVC - I do not know that this is the best MVC framework (customer-side-wise), but it forces you to define models, controllers And it comes with a test framework to ensure that things go according to plan.

Let me know that it helps!


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -