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 8568581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:08:39+00:00 2026-06-11T18:08:39+00:00

I am trying to learn Codeigniter. I have built a simple MVC following the

  • 0

I am trying to learn Codeigniter. I have built a simple MVC following the tutorials on the CI site. This is my controller…

<?php

class Pages extends CI_Controller {

    public function view($page = 'home'){

        if(!file_exists(APPPATH.'/views/pages/'.$page.'.php')){
            show_404();
        }

        $data['title'] = ucfirst($page);

        $this->load->view('templates/header', $data);
        $this->load->view('pages/'.$page, $data);
        $this->load->view('templates/footer', $data);
    }
}

Here is the header template…

<html>
<head>
    <title><?php echo $title ?> - WurkWithUs</title>
    <link rel="stylesheet" href="http://localhost/ci/CodeIgniter_2.1.2/css/bootstrap.css" type="text/css" media="screen"/>
    <link rel="stylesheet" href="http://localhost/ci/CodeIgniter_2.1.2/css/custom.css" type="text/css" media="screen"/>
</head>
<body>
    <h1>Wurk With Us</h1>

The style sheets work when I use an absolute path like the one above. However if I try to use something like…

<link rel="stylesheet" href="<?= base_url()?>css/bootstrap.css" type="text/css" media="screen"/>

I get a blank page. When I “view page source” my style line looks like…

    <link rel="stylesheet" href="

I have tried to follow the suggestions here and I get the same results i.e. document stops being parsed at the “href=” line.

What am I doing wrong? Is there a better way to load my stylesheets?

  • 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-06-11T18:08:40+00:00Added an answer on June 11, 2026 at 6:08 pm

    I’ve had this issue many, many times. I’d bet money you’re not loading in the URL helper. It does not autoload, so either load it in your controller or autoload it.

    If you choose to lead it in your controller, call

    $this->load->helper('url');
    

    before you load the view.

    The reason you see the href blank in the source is because there was a PHP error at that point (it could not find the method base_url())

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

Sidebar

Related Questions

I have the following controller and view. I am trying to learn jquery in
I am trying to learn PHP with codeigniter, had have come across a problem.
I have a simple crud application with Codeigniter. I'm still trying to learn the
i'm trying to learn codeigniter (following a book) but don't understand why the web
Trying to learn about php's arrays today. I have a set of arrays like
trying to learn and practice arrays but I have a problem with this small
I trying to learn OOP and I've made this class class boo{ function boo(&another_class,
I am trying to learn CodeIgniter to use for a shopping site, but I
Trying to learn some geospatial python. More or less following the class notes here
I am trying to learn codeigniter and for some reason I can't do the

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.