Yii Separation Of Client Side And Server Side?

Hello everyone! I’m a new developer to both Yii and the MVC architecture. I have experience with ASP.NET (Web Forms), and I’m working on a small project with a friend. I have a question about the way to develop for Yii and have a total separation of the client side (which my friend will manage with his skills on CSS, JavaScript, HTML, AJAX, etc.), and the server side (which I will do with my skills on databases and server side coding).

I’ve only been working and studying Yii for a bit, so I know it can be annoying to have a newbie asking this when he hasn’t even finished studying, but the truth is that we need to get this done and need to know if Yii will serve our purpose, or we need to switch to another technology, be it because it’s not possible with the way Yii works, or because I need way more experience than what I have right now with the framework.

To illustrate my question, I attached a picture. It’s not exactly pretty but I hope it’s easy to get my point across with it. It will be easy to understand if you have used ASP.NET yourself.


ASP Yii.jpg

I’ll explain the point of it all, again. The important part is the separation of the Server Side code and files from the client side. My partner shouldn’t need to learn to use anything from Yii, and just focus on his JavaScript files and objects, CSS, and HTML, and use them to interact with Yii.

In the ASP.NET WebForms part of the illustration, I would make the C#/VB classes and program them like models. Just a way to abstract the DataBase. My .aspx pages and Generic Handlers would work as the controllers, taking instructions and executing actions depending on what is posted to them. Finally, the HTML file (in practice, my friend would probably use a “dumb” .aspx file that would have no server side code) would work as the view, just displaying the content in such a way that he can use it with his JavaScript files and objects to make a rich interface for the user. I don’t mean that this is an MVC architecture, I just tried to compare the ASP.NET approach I had in mind with MVC.

With the above, the application can be programmed to work with a normal post to the server, or to make an AJAX call if JavaScript is enabled, and so with that architecture we can do what we want without troubling each other. For example, he could just ask me for X information from Y model to display data about Z, and I can just give him a JSON from a Generic Handler and he would do whatever. On the other hand, I can just tell him which data to send to me (either AJAX or server post) and I’ll just receive it with my server side code and do whatever, so it’s a very convenient way to work.

We want to do this with Yii for a couple of reasons, but I’m having trouble in figuring out a way to do it, since Yii (or MVC) seems to be more strict, while I can just do whatever I want on ASP.NET. Again, I’ve never used MVC until Yii, so maybe I just lack the experience to do it. I’m asking for any suggestions on how to achieve this.

As of right now, I can only think of the following:

Work with Yii’s MVC pattern and have my partner use the Views I create to write his HTML (but he shouldn’t need to understand Yii). Some of the things that worry me is the way that we will work with AJAX calls, both sending and receiving, the way Yii makes its forms when creating models since I wanted complete control over them, so I can just receive them in any way I want, because I use plenty of multi nested models (like Poll with Questions with Answers), among other things.

Thank you for your attention.