I'm trying to access the controller from another CodeIgniter.
I have a CodeIgniter 3.0.4 that containing:
Application
codeigniter2
css
js
...
so I have already tried $this->load->library('../controllers/home'); ,
but it shows me the Unable to load the requested class: Home
And I'm trying to login to both at the same time so I need to access each Session
I would strongly suggest that you simply either import the required library or combine both apps into the latest CI 3.1 as there have been several security fixes plus many more bug fixes. Upgrading from 2.x to 3.x is usually a very simple task.
However, you will not be able to use the CI loader to load a controller or library outside the normal directories, and you will not be able to share sessions across them either, as both sessions will have a different format for their session tables.
At a push, you might be able to create a bridge library, that includes the files you want, from the older CI version, but to be honest, unless the libraries you are connecting to are completely empty of any CI references, more like functional helpers rather than libraries, it just is not going to work, or would take far more work to achieve that it would to just upgrade and combine your old system. The advantages of doing that far outweigh the problems you are going to face with a bridging mechanism.
Sorry if that is not a lot of help, but in short, combine them into one app and upgrade to the latest version ASAP.
Best wishes,
Paul.
Related
I've been using CodeIgniter for a few months and recently discovered Bonfire, which looks like a great foundation for CI projects, despite the current build using almost outdated resources like Bootstrap 2.
I really love the module system in Bonfire, it seems like a very efficient method for creating completely independent subsystems. However, I wonder how compatible these modules would be with a normal CodeIgniter installation. Obviously you can't just dump the modules folder in, CI wouldn't know what to do with it, but is there any way to restructure a BF module into a third party plugin or something that can be used in CI?
Similarly, would it be possible to extract files from a CI installation and package them as a BF module (obviously with some tweaking)?
I would imagine the answer to those questions would probably be "of course not", so I just want to make my understanding clear; if I decide to develop with Bonfire, I would essentially be stuck using it without being able to revert to vanilla CodeIgniter and I would only be able to share my modules with other Bonfire users. Correct?
Basically the very first difference is that bonfire works on HMVC (Hierarchical model–view–controller) which means every module will contain its own model view and controller.
Yes it can easily be integrate with the vanilla codeIgniter you mentioned because the framework basically following the codeIgniter rules and provided a CMS with great functions.
Some features like:
Built-In Admin Area
Modular Coding
Data Maintenance
For more details check the documentation
I want to use Laravel Bootstrapper bundle http://bundles.laravel.com/bundle/bootstrapper with my CodeIgniter application.
How can i utilize autoloader functionality to use Bootstrapper bundle code in CodeIgniter in native PHP 5 fashion.
Button::make('Abc')->with_icon('ok');
Do you suggest to convert Bootstrapper bundle in CodeIgniter library or we can use it as it is.
I am using bootstrap for creating views, thus already including bootstrap specific css, js & images.
Please help, so that the bundle can be used with CodeIgniter
Why? It's not designed to work with CI, you'll probably have to mess about alot to get it working. See one of the many versions available for CI here https://github.com/vesparny/codeigniter-html5boilerplate-twitter-bootstrap.
Further more, I dont see any great advantage of having a bootstrap CI integration, if you do then go for it but I just use my own customised bootstrap and load it in as normal in template/view files. Works just fine and keeps all those UI/view bits and pieces separate for designers/Front-end coders who panic at the sight of php.
All this work trying to keep design, function and layout separate and people go to great effort to ruin it with something like this.
I'm planning to use a PHP framework (Yii) for my future project due to the amount of features that it would contain. I have done a few PHP projects in the past and I now realize how disorganized they can get after a while, even if you use a proper directory structure. So, basically, I'm wondering if everything in PHP, can also be done in a framework without tweaking the core framework itself. Will there be any limits? Can I use PHP classes like geolocation, phpexcel or phpthumb: http://phpthumb.gxdlabs.com? Preferably Yii. Thank you!
I'm wondering if everything in PHP, can also be done in a framework without tweaking the core framework itsel
No, every framework has its limits but some are more flexible than others. For example, some frameworks don't allow you to connect to multiple data-sources with their model implementation. But if it's a decent framework, you should be able to extend or swap out those shortcomings with your own or another implementation.
Can I use PHP classes like geolocation, phpexcel or phpthumb
Yes, most frameworks allow easy integration with other libraries. I found a link showing how to integrate phpexcel with Yii:
http://www.yiiframework.com/wiki/101/how-to-use-phpexcel-external-library-with-yii/
Yes All framworks have proscons, but it's very important that how we will user them, i.e cakephp provide the helper class to create html and form but no need to use each and every time that because it will make slow your application
CakePHP have also cache memory limitation, we found in one popular auction script.
I have a web application which has been developed with symfony 1.4. I have a pretty large code base (and growing). Circa 80,000 lines of code (actions, forms, models, templates etc.)
I'm using the default doctrine version which ships with symfony 1.4.
I've just started developing a mobile version using Sencha touch. I don't wish to use symfony for the REST web services because:
REST services in Symfony 1.4 is not great. For example, If i want a PUT request I have to pass a 'sf_method' parameter specifiying that the request method is PUT. This isn't true REST and it's not ideal for Sencha touch.
I don't need all of the unnecessary symfony functionality(for example the plugins that are autoloaded in the ProjectConfiguration file, the form framework etc.) that you'd use to develop a standard web app. All I need is to define my REST routes and return the specified JSON (as everything that needs to be returned for Sencha touch will be JSON)
I want to keep my mobile app as bloated-free, efficient and quick as possible. And unfortunately for this task, Symfony 1.4 would not be the best choice for using as the backend architecture for my mobile app. If I had chosen symfony2 (it was in it's beta phase, alas) it would be a different story as symfony2 supports true REST functionality. What I do need, however, is the ability to use my current doctrine models (I have circa 90 models) in a chosen REST framework.
Basically, in a nutshell what I need is as simple as this:
Call a rest route->Query my doctrine models->return the JSON without using symfony.
So my question, what would be your advice? I don't want this to be a question of which is the best PHP rest framework, however, what I would like to know is what would be a good REST framework which i can develop efficiently and quickly REST service, make use of my doctrine models and is easily extendable.
Here at my employer, I've created a rather big application with a ExtJS frontend, and Symfony 1.4 backend. And two be honest, I don't feel limited by Symfony 1.4 in any way?
First of: I created my own base controller class (which extends sfActions). This controller can handle (render) different types of data. It has generic handling for Doctrine_Query, Doctrine_Collection, Doctrine_Model and array types.
Also the plugins make me help organize the code, and in some cases plugins are shared between differend projects, so that's also a big plus.
And the extra functionality like forms: it's only prepared for you in the autoloader, you don't have to use it. And I don't think it causes any real performance issues (at least not for me). But I like to use the extra sfValidator framework, to make sure data are correct.
The only real "problem" is indeed the HTTP REST-ful commands, especially PUT and DELETE. I just worked around this problem by generating a controller for each 'manageable' model, and implement specific get, list, create, update and delete actions. So when I would like to manage an Object, I call the objects controller, which has executeCreate, executeUpdate and executeDelete actions.
The reason I read, was that Symfony didn't and couldn't implement this feature because PHP has really bad support this. I don't know if this is true, but if this is your only 'real' issue, you could try to fix this in the Symfony core.
So my advice:
If the raw performance is your problem: try profiling your code, install a opcode (APC) cache, and profile your code (yes, that's double).
If the HTTP PUT command is your problem: I would either work around this (that's the way I solved it), or try to fix it in the core.
I am looking to reduce redundancies in code shared across entire web sites. I have tinkered with several frameworks but cannot think of any that allow you to EASILY separate the framework code from the site code while sharing it to multiple sites at the same time.
What PHP frameworks can do this easily?
EDIT - I am trying to determine which frameworks are the easiest to share.. I was already guessing that nearly all could be shared, but which frameworks are geared towards sharing? It sounds like Yii recommends placing the framework code outside the site code, that is a good start.
If someone is sharing the same framework code across sites already, I would love to know about that.
It's pretty easy to do that with Fuel (http://fuelphp.com).
Each website has an index.php where some paths are defined:
/**
* Set all the paths here
*/
$app_path = '../fuel/app/';
$package_path = '../fuel/packages/';
$core_path = '../fuel/core/';
As you can see, you may share the core and packages in a central repository and create a single app and public folders to each web site.
You may even share an app with different web sites customizing stuff (let's say, the site title or the database used) by just setting a different environment in the .htaccess. That works out-of-the-box for development/stage/production sites, for example, but may be extended to anything. You may also setup central packages to use in multiple apps. Powerful, easy and just works.
Many can do this. For instance YII is supposed to be installed OUTSIDE of your www-root directory (httpdocs, /var/www/ or something like that). You can use several sites to point to that base dir.
Any framework (or part) that does not need specific settings for your site can be shared among multiple sites I guess.
I believe Zend can do what you ask, possibly even Symfony and Fuel, and I'm sure many other frameworks that allow you to pick what parts of it to use will let you do this.
However, doing so will require you to do a little more configuring to get it all running. Which is kind of why I ended up creating my own framework.
Symfony does. I love the Symfony framework, and it comes with some great frameworks. You might like the Routing and YAML ones. A person I know calls Symfony the best php framework.
Symfony components
Some of the components have their own specific sites
You can find a really good documentation here.
Symfony2 is suitable for your needs. It's a full stack framework with a lot of standalone components. It works with "bundles", a bundle is a kind of container with a complete logic (controllers, model objects, views, assets, configuration, ...). That means you write one bundle and you can reuse it without any problem.
But you can also consider symfony 1.4. One project can handles many applications so your model is shared across these applications and the same code can be reused in all applications. Note an application can be a complete website.
I can't think of any frameworks that do this natively, but you could use several SVN (or hg, etc) repositories to accomplish this. Example using CakePHP:
1 repo has the CakePHP default files. If you wish to update CakePHP,
you update this repo in the future.
1 repo per website that stores everything inside your app folder.
It's not built in functionality, but it isn't very difficult to setup either.