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:

Code:
/application/themes/default/views/layouts/default

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

Code:
/application/themes/default/css

but when I use append_metadata nothing happen:

Code:
$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

[eluser]CroNiX[/eluser]
try putting your css in your root.

/site_root
-/css
-/js
-/system (ci)
-index.php

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
Code:
/application/themes/my_theme/views/layouts/default.php

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
Code:
$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

[eluser]InsiteFX[/eluser]
Get Phil's Asset Library!

https://github.com/philsturgeon/codeigniter-asset

InsiteFX

El Forum

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

exactly what I was looking for!

Thanks