0

I am new to codeigniter and it may sound stupid but I can't figure it out.

I wanted to load an HTML template and I copied the whole content in views directory, but when I loaded the page in the controller, the page doesn't have any CSS, JavaScript or images.

Its just plain, as you can see below, it's just text without content.

enter image description here

I even tried adding the CSS, JS and image folders in the main codeigniter route next to index.php, but it didn't work either.

<?php
class Test1 extends CI_Controller{
    function index(){
        $this->load->view('index.html');
        function _test2()
        {


        }    
    }    
}
3
  • 2
    You should read their documentation carefully. They have a pretty good one. Follow this link codeigniter.com/user_guide/general/views.html , hope it will help you. Commented Feb 24, 2017 at 11:07
  • What is in the view? specifically between <header> and </header> Commented Feb 24, 2017 at 11:22
  • its an ordinary html file just like the others nothing special about Commented Feb 24, 2017 at 12:26

1 Answer 1

1

This happen because of the url which you are passing.

Your URL : localhost/igniter/index.php/test and your file is located in igniter/index.html, So u have to folow the below steps.

Method 1

Step 1: remove index.php from your url. For this use the following code

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L]

Step 2: You have to reset the links in your html page as ../*followed by your file name* You have to include ../ on every links in html page

Now enter your url as localhost/igniter/test. It will display all the image with css designs.

Method 2

You can use IFrame to view the page with same design.

If you need more assistance on this, I'm happy to guide you through.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.