skip to Main Content

I want to load css file from app/asset/css/tes.cssthis is my css file

this is my controller

this is my route

this is my view

I tried many ways but still couldn’t. Please help me

I want to access the CSS file for the lala.php in the view folder, by saving the CSS file in the assets folder

2

Answers


  1. Use file_as_string().

    Example:

    <style><?= file_as_string(APPPATH . 'asset/css/test.css') ?></style>
    
    Login or Signup to reply.
  2. The problem is with your path in the controller. The correct path should be:

    $path = FCPATH . '../app/asset/css/tes.css';
    

    Or a cleaner way is:

    $path = APPPATH . 'asset/css/tes.css';
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search