Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6243415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:08:09+00:00 2026-05-24T12:08:09+00:00

hi i am facing problem in loading css file. <?php //if ( ! defined(BASEPATH))

  • 0

hi i am facing problem in loading css file.

<?php  //if ( ! defined("BASEPATH")) exit("No direct script access allowed");


class Controller2 extends CI_Controller
{


function index()
{
if ($this->input->post('button'))
$this->test();
else 
$this->load->view('2');
}



function test()
{
$this->load->view('2');
}

}
?>

when i first call my controller index function it is loading view “2” with proper html and css but when i press a button inside my “2” view my controller is calling another function TEST but this time test is not loading the same view with css.

can anyone solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:08:11+00:00Added an answer on May 24, 2026 at 12:08 pm

    Using my psychic powers, because you’ve provided very little, I believe the answer is that you are providing a relative path to your CSS file.

    In your view, you need to make sure that the CSS file is referenced absolutely. Examples:

    Wrong

    <link rel="stylesheet" type="text/css" href="style.css" />
    

    This will only work if the path stays the same. However, your path is changing from /controller2 to /controller2/test, which means on the second page, the browser is going to look for /controller2/style.css for the first method, and /controller2/test/style.css for the second.

    Correct

    <link rel="stylesheet" type="text/css" href="<?php echo site_url('style.css') ?>" />
    

    Now, the output will be an absolute path to the stylesheet. Now, no matter the page, the browser will look in the same place.

    (If this works for you, please make sure you check the checkmark to accept the answer. And then go back and accept the working answers from your previous questions!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing problem with the control flajaxian.FileUploader i.e. after downloading the dll file
I'm currently working a lot with DDD, and I'm facing a problem when loading/operating
I'm facing a big problem. My app is loading XML files (within AsyknTask) from
I am facing problem while trying to open a simple text file in C#.
I am facing problem in accessing database file when I am running it on
Possible Duplicate: Dynamically loading an external CSS file I'm trying to create a dynamic
I am facing problem with an Oracle Query in a .net 2.0 based windows
I am new to struts 2. I am facing problem in filling Select tag
When facing the problem of validating a property in a JSF2 application there are
I am facing a problem with .NET generics. The thing I want to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.