Welcome Guest, Not a member yet? Register   Sign In
Code Igniter fresh newbie alert. Using templates as a view problem.
#1

[eluser]dazamate[/eluser]
So I've discovered code igniter and I am all excited about learning & mastering it, I hate this part where I don't know enough to perform basic tasks.

I've purchased a html template from theme forest. I copied all the theme contents into the views folder but renames the purchased theme's index.html to 'home_view.php'.

This is how I am going about loading the downloaded template page...

Code:
<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class home extends CI_Controller

  {
  public function index()
    {
      $this->load->view('home_view');
    }
  
}

?>

So now when I to to /index.php/home it does load the page, but it won't load any of the images, css or js. But I have put the templates /images and /js folder in views so they should of been accessible.

Does code igniter block including files from within the view folder? Or have I just made some dumb-ass newbie mistake.

Thanks for you time Smile

Look forward to hearing back from you guys.
#2

[eluser]Aken[/eluser]
CI blocks HTTP requests for anything in the /applications and /system folders. You should move your theme's static assets (images, CSS, JS) to the root of your application (AKA wherever index.php is).

CI blocks these requests using the .htaccess in those respective folders.
#3

[eluser]dazamate[/eluser]
Thanks Aken,

I moved the files the to codeigniter root folder, first it didn't work. But then I added a leading backslash to all the urls in the home_view .

that were set at images/image.jpg

changed to /images/image.jpg and everything lit up on the page.

Thanks but I doubt you've heard the last of me sorry Tongue
#4

[eluser]InsiteFX[/eluser]

Code:
application
system
index.php
assets
-- themes
-- css
-- js
-- etc
#5

[eluser]Aken[/eluser]
[quote author="dazamate" date="1345196164"]Thanks Aken,

I moved the files the to codeigniter root folder, first it didn't work. But then I added a leading backslash to all the urls in the home_view .

that were set at images/image.jpg

changed to /images/image.jpg and everything lit up on the page.

Thanks but I doubt you've heard the last of me sorry Tongue[/quote]
That's the difference between absolute and relative URLs. Google around for that, it's something you should learn. Smile




Theme © iAndrew 2016 - Forum software by © MyBB