What is the best way to use codeIgniter with BoilerplateJS? should I put the codeIgniter folder in a BoilerplateJS folder or the contrary? Or something else? Need to make an authentifcation page in codeigniter and redirect the application in boilerplateJS.
Thanks.
I tried BoilerplateJS with CI in the following way:
Basically this is including BoilerplateJS in CodeIgniter folder.
I included all the BoilerplateJS code except the index file in to a folder named public which is in the root folder of CodeIgniter. The index file is placed in the views folder and will be loaded by a controller. (See the image)
For this to work some file paths had to be tweaked.
File paths in boilerplatejs index file (boilerplate.html in my case) had to be changed as follows:
./libs/jquery/jquery-min.js >>to>> public/libs/jquery/jquery-min.js
./libs/underscore/underscore-1.3.3.js >>to>> public/libs/underscore/underscore-1.3.3.js
and so on.
In main.js requirejs path configurations should be changed to:
require.config({
//Let's define short alias for commonly used AMD libraries and name-spaces.
paths : {
// requirejs plugins in use
text : 'libs/require/text',
i18n : 'libs/require/i18n',
path : 'libs/require/path',
// namespace that aggregate core classes that are in frequent use
Boiler : './app/core/_boiler_'
}
});
And in your controller you can load boilerplatejs by: $this->load->view('boilerplate.html');
I was thinking of integrating BoilerplateJS and CodeIgniter and probably use codeignighter-rest server for some time.
If all goes well I will share the code within the week.
A sample project is available at: https://github.com/slayerjay/codeigniter-boilerplatejs
EDIT Adding my view on CodeIgniter and BoilerplateJS
Firstly I have not (yet) done any major projects with BoilerplateJS and Codeigniter. But I have done projects using CI and the CI REST Server and know BoilerplateJS in and out.
I do not have much experience with other PHP frameworks (I have meddled with cakePHP and some others) but for me CI helps me to organize my code according to MVC pattern in a clean way, and provides excellent helper libraries and documentation.
As the OP rightly said, authentication is handled best outside BoilerplateJS and this can be done nicely with something like ion-auth for CI. After the user is authenticated and the SPA is loaded, the rest of the calls will be handled by the CodeIgniter REST server.
In this case you won’t be using much of the View aspect of your MVC architecture, but CI’s models and helpers would be of great help.
If you just need a simple REST server you can go with some lightweight solution that just provides REST type routing, but in many cases you will need to interact with a database and do some data processing.
So if you have decided to have a PHP backend for your application, Codeigniter with the REST server is a good choice.
Related
Laravel is a secure php framework following MVC pattern design .
But it's a question for me if i use Model codes like DB:: class inside .blade files , is it secure or not ?
I know it's not good idea disturb MVC rules
But I want to test Laravel security. If anybody did this action what security problems would happen?
It's as secure/insecure (depending on your implementation) as in any other part of the framework. But no, it's not a good idea. You named MVC. Your template file (.blade) should receive data, not fetch it.
I have to install 10+ APIs in my third_party folder, each has it´s own examples files for testing oauth validation and other features.
without too many changes, has anyone found an easy way to hack the Codeigniter routing to execute files like
$route['hackToken'] = "/application/third_party/googleads-php-lib-master/examples/AdWords/Auth/GetRefreshToken.php";
Codeigniter expects to find a class derived from Controller at the target of a route. So, you will not be able to do this unless you create a Controller for each example.
I'm a new kid with CI and ion_auth and have both running correctly. I have also created a view/template of a view/template/header and view/template/footer on another page ('welcome') that is a part of a fairly complex html5 responsive template with all my assets in a directory called assets/html5templateV1/css etc.
The question is what is the best approach of using the views/auth/login.php file with the template so I have
A nice looking login page /failed login / request pwd page etc.
The login page uses a templated HTML layout approach (mine is probably incorrect)
Updates to ion_auth can be fairly easily installed
The next person along doesn't say "WT?" and start pulling hair out.
Thanks
There is no need to use ion_auth views or controllers. they are just for reference. we have to use their function as they have define in model for login/logout/register etc... just simply put his model,library and config file to the respective folder of codeigniter in your project and just use their function as they have shown in demo
I am running multiple applications with a single Codeigniter system/ folder using the recommended way on the Codeigniter wiki. Each application runs fine and I can link between apps using absolute URLs.
Is there some way I can use or extend the URL helper class (functions like anchor(), redirect()... etc.) to generate links to controllers across applications. I would like to avoid absolute URLs
Thanks!
You can use Matchbox or Modular separation and creat multiple modules. Then you can add controllers, models etc in each module.
in yii i could have mvc components (acts like an own application). could i have this too in codeigniter?
eg. in SYSTEM/APPLICATION have a folder called COMPONENTS and in there i put stand-alone applications that would be a part of the application. components like ADDRESS BOOK, MAIL, TWITTER and so on. every component folder has folders like: models, views, controllers, config etc.
so a component model extends the application model which in turn extends system's (code igniter) model. the same goes for view and controller.
i've already got a lot of these components which i want to use in codeigniter. is it good idea to place them as i said in SYSTEM/APPLICATION/COMPONENTS or is there best practice for this?
You can do this in CodeIgniter using v1.7.2 or 2.0, but using Packages as Billiam suggested would not work and sadly he is just confusing you.
You are basically looking for a HMVC architecture and this can be provided with a system called Modular Separation.
That works with CodeIgniter 1.7.2 and I have patched it to work with the (still unfinished) CodeIgniter 2.0 branch on the link in the entry.
Not by default in CI 1.7.2, but 'packages' will be available in 2.0.
Added ability to set "Package" paths -
specific paths where the Loader and
Config classes should try to look
first for a requested file. This
allows distribution of
sub-applications with their own
libraries, models, config files, etc.
in a single "package" directory. See
the Loader
class documentation for more
details.
From: http://bitbucket.org/ellislab/codeigniter/src/tip/user_guide/changelog.html
Also, take a look at Modular Extensions - HMVC