HMVC and Cjax |
[eluser]jonez[/eluser]
[quote author="Ajaxboy" date="1402257901"]@jonez, Second, to address the response from jonez, 1. No Cjax does not have any dependencies on any JS library, or any other dependencies whatsoever. (Cjax has it's own) 2. "JS has no place in PHP code", Cjax is not just any JS library. It is a ecosystem of finely built integration of PHP bridge for JS. There is no actual JS code inside your PHP, It is 100% PHP. So I think you should take your time to investigate a little.[/quote] I'll probably come off as a douche, but here's my thoughts. If you are new to JS/AJAX and use CI exclusively this library will help you a lot. What it won't do is help you learn AJAX, which is what you should be doing if you are interested in advancing your skill set. What happens if you change jobs and they don't use CI? You're pooched. 1. Unless you are writing NodeJS, JavaScript is client side code. Your client and server should be independent of one another. The server responds to HTTP requests, your front end assembles the response data and presents it to the user. JS is a view item and as such should have no knowledge or access to controller/models. In true MVC that separation is important and your library skips convention for convenience. Some dev's are okay with that, some aren't (me being one of them). 2. Any code you write today should be module based and re-usable. Procedural programming is dead, OOP is here to stay. That's why you see people moving to Require/CommonJS modules. It's simply too difficult and time consuming to maintain a large project that doesn't follow standard patterns. 3. Binding client side events from a server side language is wrong on so many levels... I don't want to sound harsh, and again this is just my opinion. You are breaking a lot of conventions that exist for good reason. You are helping people build better sites then they could otherwise, I will give you credit for that. I just wish more dev's would take the time to learn it from scratch than rely on a bridge that isn't necessary and isn't beneficial to your career in the long run.
[eluser]Ajaxboy[/eluser]
1. Cjax doesn't require CI, that is why there are 2 versions of Cjax available. It can run on any website, application, it can be used across multiple platforms, projects and frameworks. Since you rather take 30 minutes to write a lot of stuff, instead of taking 10 minutes to learn about what you are talking about, you wouldn't know that. 2. Cjax is module/plugin based, and is 100% OOP. so again.. if you only took 2 minutes to find out you wouldn't be writing smack. 3. Actually that is what Ajax all about. It is a pretty interesting technology, you should read about it. 4. I appreciate your opinion, more like un-educated opinion... nonetheless, is respected. Thinking outside the box projects is the reason the world keeps moving forward.. a lot of technologies have grown from different smaller projects and ideas that brake the conventions of what the web used to be back when internet explore 6.0 dominated the web. You should take time to learn multiple technologies, a lot of people come from a Ajax background, Jquery, and JavaScript, and still choose to use Cjax.. because they read about it, took the time investigate and test.. and noticed it was helpful to them. While there are cons and pros for a lot of things, the ability to be able choose what technology to use and having more choices is what drives the Industry.
[eluser]jonez[/eluser]
[quote author="Ajaxboy" date="1402616322"]1. Cjax doesn't require CI, that is why there are 2 versions of Cjax available. It can run on any website, application, it can be used across multiple platforms, projects and frameworks. Since you rather take 30 minutes to write a lot of stuff, instead of taking 10 minutes to learn about what you are talking about, you wouldn't know that.[/quote] I'll admit, I haven't researched your plugin thoroughly. I'll explain why; [quote author="Ajaxboy" date="1402616322"]2. Cjax is module/plugin based, and is 100% OOP. so again.. if you only took 2 minutes to find out you wouldn't be writing smack.[/quote] Your code is not what I'm talking about, what I meant by that is the code a developer using Cjax produces is not as re-usable as JS modules. Server side we design using MVC principals, what I'm suggesting is the client is no different and should be built the same way. In a large scale application that is client heavy you should have an inheritance pattern for modules. You should have a base module (for say binding global items like a site search box) and each module (client portion of each controller in CI) should have it's own JS module that extends that base. It should stack exactly as CI does with MY_controller and individual controllers. Correct me if I'm wrong, but wouldn't building an extendable client using that pattern be next to impossible with Cjax? Quote:3. Actually that is what Ajax all about. It is a pretty interesting technology, you should read about it.AJAX is only a transport mechanism. Like the hidden iframe submits we used before AJAX existed, or socket's which replace AJAX in real-time apps. Event bindings are a feature of the DOM and have nothing to do with the server or AJAX. Quote:4. I appreciate your opinion, more like un-educated opinion... nonetheless, is respected. Thinking outside the box projects is the reason the world keeps moving forward.. a lot of technologies have grown from different smaller projects and ideas that brake the conventions of what the web used to be back when internet explore 6.0 dominated the web.I know I'm opinionated, that doesn't make my thoughts un-educated. Here's my Github repo if you'd like to take a look at some of my code. My CI mod is out of date, if you look at the game engine blindGL you'll see a lot of the design patterns I spoke about above. It's pure JS and can be run w/o a server. The same patterns exist in the client tools of my CI mod, I don't actively maintain that repo so I can't guarantee it will work with the latest CI3 build. Quote:You should take time to learn multiple technologies, a lot of people come from a Ajax background, Jquery, and JavaScript, and still choose to use Cjax.. because they read about it, took the time investigate and test.. and noticed it was helpful to them. While there are cons and pros for a lot of things, the ability to be able choose what technology to use and having more choices is what drives the Industry.That's exactly my point. Tools like jQuery are destroying our development pool. The number of dev's who cannot write a lick of pure JS is disturbing. Every time I see a developer use a $.each loop I shake my head in despair. A lot of dev's have no idea what's going on under the hood (closure + bleeding memory to the garbage collector) when they don't even need one. They literally use it to replace for loops... Just because we have tools to bridge functionality does not mean they should be relied on at all times. I don't use CSS processors, I don't use ORM's, I don't believe a developer should use a bridge when they can write the same code natively. I don't mean any disrespect, and if you are reading this thread and thinking about using Cjax please take my posts with a grain of salt. What is good for me may not be good for you, and you may not have the time to build software as I do. All I'm asking is that you understand the conventions you are breaking and the impacts of that decision.
[eluser]Ajaxboy[/eluser]
If you are uncomfortable with it simply don't use it. People have their reasons to use whatever tools they choose.
[eluser]jonez[/eluser]
I have a feeling my posts came across as overly critical and that was not my intention. After researching your plugin further I'll commend you on a few features. I (incorrectly) assumed you were injecting inline scripts into the head tag, your solution was unexpected and quite clever. I'm also amazed at the level of abstraction you were able to achieve while maintaining functionality. I stand by my point about re-usability and conventions for large projects, but you have built quite an API and you deserve credit for that.
[eluser]salvomil[/eluser]
Hi, I got the same problem of Fredrik-s, the error "Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid." on Codeigniter with HMVC Same structure, downloaded and unzipped and copied AJAXFW_4CI_5.8.zip, but I get the error. Is there a remote way to resolve the issue? Thank you, Salvo.
[eluser]salvomil[/eluser]
I got something to work, but it does not seem a good thing.... I modified the system file CodeIgniter.php as follow: // Load the local application controller // Note: The Router class automatically validates the controller path using the router->_validate_request(). // If this include fails it means that the default controller in the Routes.php file is not resolving to something valid. if ( $RTR->fetch_class()=='AjaxController' ) { $path = APPPATH.'controllers/'.$RTR->fetch_class().'.php'; }else{ $path = APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'; } if ( ! $path ) { show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.'); } //include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'); // Original include( $path ); this because $RTR->fetch_directory() appends ../modules/module/controller ..... and it seem to go but I have not tested all the application.... |
Welcome Guest, Not a member yet? Register Sign In |