• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Integrating UIkit with codeigniter

#1
Good morning

I am new to codeigniter and MVC in general(I am Front-end developer) but I grasp the concept and it seems pretty simple.
I would like to use uikit with codeigniter could someone please direct me how to integrate one with the other, I would really appreciate it.

I've tried copy and pasting the link to a .js file but it gives me a 403 which is 'access forbidden' I have to mention that I am using a local web server(xampp) I also have to mention that I used welcome_message.php(as a test) to add my scripts and stylesheets(only for testing purposes)  To style something through Uikit's classes, but the styling has no effect, I've tried googling this as well but still no effect. I am using CI 3.x and I have not changed anything from the default codeigniter post extraction and installation.

How do I add stylesheets and scripts globally so that I have to define this only once?

Thank You

Kind Regards

Ryno Labuschagne
Reply

#2
Newbie mistake maybe I should've built on the framework and not try to modify it haha, 'I thought by myself, if I have to integrate bootstrappers into codeigniter then it will take me a while every time I want to use something else for different project, maybe I should integrate uikit into my web app.'
Reply

#3
For one break up the welcome_message file into header, content and footer views.

CodeIgniter developers usually create an assets directory in the route with the index.php file
place sub-directories under it cs images img js etc;

Then when you need to load them load the url_helper and use this in your header and footer views

PHP Code:
<?php echo base_url('assets/css/filename.css'); ?>


I created an assets_helper and autoload it in CI's auloadload.php

./application/helpers/asset_helper.php

PHP Code:
/**
 * Helper asset ()
 * ------------------------------------------------------------------------
 *
 * @access    public
 * @param    string
 * @return    string
 */
if ( ! function_exists('asset'))
{
    function 
asset($uri)
    {
        
$_ci get_instance();
        return 
$_ci->config->base_url('assets/'.$uri);
    }


Hope this helps.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#4
The uikit I have never seen before but is is just some js and css components, so it is not really a case of 'integrating', just simply linking to the resources and using in your view files.

Your page outputs would be something like

PHP Code:
$this->load->view('header_view'$header_data);
$this->load->view('page'$page_data);
$this->load->view('footer_view'$footer_data); 

With your header file containing links to the required css files, your footer with the required js files.

Best wishes,

Paul.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.