PHP - MVC within MVC - php

I'm learning about MVC frameworks, and I am about to start building a website that will eventually store all of my work. I plan to build a simple blog system using a MVC framework. But then I also want to host my other work within that MVC. For instance, if I have just created a simple todo list app that is also built with an MVC framework, I want to be host that on my portfolio too.
For instance, myportfolio.com will be the main app. myportfolio.com/otherapp will be a piece of work that I would like to host on my portfolio.
Can anybody provide any suggestions as to how this might be achieved, without having to port all models, views and controllers to a single main app?

Just make an exception on how the URL is handled. myportfolio.com/, myportfolio.com/foo, myportfolio.com/bar etc. are all handled by your MVC blogging system, only myportfolio.com/otherapp is handled by your otherapp. This can simply be achieved through RewriteRules in an .htaccess file, but how exactly depends on how exactly your framework works.

Related

Silverstripe framework and cms used together and separately

Why would one build off with just the Silverstripe Framework only and not use the CMS and vice versa. For instance routing and menus can be handled with the cms included or not.
You can use the framework without using the CMS fine. The CMS without the framework however, is not possible.
There are cases, where you would have enough with just the framework, when you're building a backend application for a mobile app for example and all it has to do is provide data to that app. No need for the CMS in that case.

How would I use the Joomla Framework vs. creating Joomla extensions?

I have experience with Joomla and have modified and wrote some simple Joomla extensions. I don't have experience using one of the popular PHP frameworks (such as CakePHP), but I was thinking about using the Joomla framework because I'm familiar with Joomla. How would I use the Joomla framework for a software project instead of using regular Joomla and writing the extensions needed for it to extend it's capabilities? Thanks!
The basic idea is that you:
Get a copy of either the whole framework or just the packages you need+dependencies (from github or composer) or use the older copy that is shipped with the CMS,
Bootstrap your application (JApplicationWeb or JApplicationCli).
Write your code using the MVC structure provided.
The big difference with writing a totally independent application is that you are doing just that, you need to build everything in the application whereas in the CMS there are already a lot of things in place. (The good part of that is that you can make new code with no legacy concerns.) For example, if you look at the JIssues project you'll see that they had to think about things like authentication. So as you would expect writing a simple application is simple, writing a complex one is complex.
You can see many examples of framework applications around, ranging from the ones found in the CLI folder of your CMS installation to JIssues, and of course the three web applications in the CMS are all examples of applications on the framework.
The Joomla Framework is intended (among other things) to be the platform upon which you can build a web-application. The framework is like the frame of one of those motorcycles they build on "American Choppers." It provides the backdrop so that you can hit the ground thinking about your app without worrying about User Authentication, database connection, and a thousand other things like those that get in the way of bringing your app to its potential audience.
If you're trying to extend Joomla, the current edition is what you should be using.

CakePHP compared to Joomla

So the past month ive been working alot with CakePHP getting to know the conventions also getting better at the MVC structure and how it works.
Now in cakephp you basicly bake Model views and controllers where Models are assoiciated to Database tables and controllers handle the request back and forward from the Model and the view.
Now Joomla is build in a different way. As far as ive understood Joomla is build up of modules and components but these components and modules follow the MVC structure.
Now to my Question:
How close is cakephp programming to Joomla programming like how does it compare? is creating components and modules the exact same thing as creating Models and Controllers in cake (execpt from the Api calls not being the same)?
The Joomla Framework has its own MVC just like all frameworks. If you develop applications on that it is somewhat different than what you would do building an extension inside the CMS.
Building an extension on the Joomla CMS is different from building an application on the framework and I really would separate that out and figure out what you want. IF you want to build on the CMS because htat give you user management, authentication, cache etc and then you build on top of that, it is a different than than building a stand along application.
So you really need to figure out which it is you want to do.

How would I integrate existing zend FW apps into 1 application?

An existing 8+ year old application is being migrated from a self-contained website to a webservice-oriented architecture to allow among other things, external parties access to the calculations and data within the application.
The application allows visitors to access insurance-related information, calculate price quotes and contact agents.
The original logic of the application has been extracted from the main application to a SOAP service - so far, so good.
Based on in-house knowledge of Zend FW, the choice was made to drop the legacy code with many downsides and move to a more robust and community-backed framework - Zend.
An initial Zend FW app has been built that consumes the WSDL and allows searching and displaying of customers. After that was finished we wanted to integrate external applications/modules for components such as a basic (!) cms, mass-mailings, polls etc.
As we consider those components essential for the end-product but not our own core-product, we thus want to use external applications for this.
However - looking at e.g. tomatocms and digitalus etc., they seem to require us to build our product into theirs - and we want it the other way around. CMS pages are the exception, and not the rule.
Integrating authentication among these applications seems very difficult, as each seems to want to be 'the' application.
TL;DR:
What would be the best solutions to integrate a CMS or other apps into an existing/in progress zend FW app?
I think the best solution for you is to create a structure for Modules/Plugins where you set a pattern of use and you will make your application understand these modules created following the specifications above.
With this you allow anyone to be creating or developing models desaclopados their application.
I think this is a good example with your Wordpress plugins. Anyone can create and embed its functionality within the application page, but of course you can make in its API limitations, controlling what you want.

PHP framework that can be included in other projects

I have a little specific concern, I hope you can help me, I have to develop an application in PHP that doesn't need to be linked to the exclusive use of its installation and could be used or "included" in other projects of PHP, I mean, to develop a web application (such as generation of a graph according to certain parameters passed) that can be used on different pages created for example in phpBB, Drupal, Dreamweaver or PHP Frameworks like CodeIgniter and Zend.
The best example of what I mean is "Google Charts Tools", you just print in the browser the access to the tool with the parameters and the tool does the rest, and this does not depend on the type of framework with which the home page was created.
In short, I'm looking for a framework or lightweight framework with which I can develop an application that simply could be called in an include() or require() on the destination page and can be used, a framework that can somehow "export" the project or application and could be used on one page without having to reinstall the framework on the target server, even the libraries could be included in the target page so you can run the application.
Was working with Codeigniter and tried to attach to a Joomla page but i couldn't because Codeigniter is linked to the URL of the page and I dont want to use Iframes.
Is there something like that?
First of all; I believe you would need some custimization, as frameworks just aren't build that way. But it isn't impossible. In Kohana for example (also codeigniter, but kohana is more flexible), you can build internal requests with Request::factory($uri). If you can find out a way to bypass direct access to index.php, or build a wrapper after which you can do stuff in the Kohana 'environment' you could do it. I don't have a ready-to-use solution, but if you try something and post the code we might be able to help you out some more!
Sounds to me like you want to write a library or class that can do certain things and which can be reused in other code. You can then build an example application around it, using a framework, which uses this library.
If you start with a whole framework, this often makes it really hard to reuse any part of the code, since the framework has certain assumptions or requirements which may not always be true for other projects. As a general rule: a framework is already a complete standalone application. What you want is something smaller than that.
Of course, you can have a look at a framework like Zend, which is basically just a loose collection of individual classes. Together they form a framework, but each part of it is individually usable. Something like CI is on the other end of the spectrum, much more heavily coupled and interdependent.

Categories