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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:03:36+00:00 2026-05-23T17:03:36+00:00

In my CodeIgniter application have a common header and footer view, which I include

  • 0

In my CodeIgniter application have a common header and footer view, which I include in different views. My header_view is as simple as:

<!DOCTYPE html>

<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    <title><?php echo $page_title;?></title>
    <link rel="stylesheet" href="<?php echo base_url();?>/css/master.css" type="text/css" media="screen" />
    <script src="<?php echo base_url();?>js/common.js" type="text/javascript"></script> 
</head>
<body>
<!-- end of header -->

Now Lets suppose I have another view called form_view, where I would like to include a CSS file form.css and a javascript file form.js. Since these files are only used in form_view, I don’t want to add them in the header_view, because then they will be included in all of the views in my application.

So my question remains, how can I include a specific css or a specific javascript file on a specific view, when using a common header like above.

Thanks.

  • 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-23T17:03:37+00:00Added an answer on May 23, 2026 at 5:03 pm

    You could write something like Zend_Bootstrap and run it before views. The bootstrap file will be responsible for setting css and js files so your header will just grab them from an array.

    Bootstrap:

    $head_array = array(
       'css' => array(
             '/static/css/style.css', 
             '/static/css/style1.css' 
          ),
       'js' => array(
             '/static/js/script.js'
          )
    )
    
    if($view == 'view_form') {
        $head_array['css'][] = '/static/css/form.css';
    }
    

    Of course this example is very primitive but it shows the idea.

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

Sidebar

Related Questions

I'm moving towards an ORM for my codeigniter application and have chosen datamapper .
I am getting echoed Disallowed Key Characters. in my CodeIgniter application when I have
I have a CodeIgniter application, but one of my controllers must call a data
I already have an express checkout integrated with my Codeigniter application. Now I want
I am currently working with a codeigniter PHP based application and have come to
In my LAMP application (using CodeIgniter), I have a call to $this->db->update... that generates
I am trying to add an external javascript file to Codeigniter application. I have
I have a CodeIgniter MVC application. I have a model called city that has
I'v built a application using codeigniter and I have a message system that displays
I'm creating an application in Codeigniter which will allow anyone, without signing in, to

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.