CodeIgniter Forums

Full Version: Template library and css, js path
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Massimiliano Marini[/eluser]
Hi all,

I'm using the Phil Sturgeon template libray and I'm using themes, but I don't know where to put css and js folders with relative files, example css/style.css and js/scripts.js

This is my currently theme path:


I've inserted the css folder here (in the same path of views folder):


but when I use append_metadata nothing happen:

$this->template->append_metadata('<link rel="stylesheet" href="/css/layout.css" type="text/css" />');

I've tried with different css folder path, but nothing ... where I'm wrong?

El Forum

try putting your css in your root.

-/system (ci)

then make the links like you did above with "/css/layout.css". If the URL starts with a / its relative to site_root.

El Forum

[eluser]Massimiliano Marini[/eluser]
Hi CroNiX,

yes, if I put all files in a root folder it works as expected, but what I want to create is a theme folder with all these files inside.

I'm using HMVC and I've created this folders path

What I want to do is a simple theme folder (in this case "my_theme") with all the files css, js, partials and layouts, the last two are ok, but I can't include or link css and js files with
$this->template->append_metadata('<link rel="stylesheet" href="path/to/css/style.css" type="text/css" />')

Is it possible? I think yes but not sure 100%.
I'm sure I'm doing something wrong, but I don't know where.

Any help will be welcome.

El Forum

Get Phil's Asset Library!


El Forum

[eluser]Massimiliano Marini[/eluser]
Hi InsiteFX,

exactly what I was looking for!