philsturgeon / codeigniter-template

Template library for CodeIgniter which supports modules, themes, partial views, etc.
411 stars 178 forks source link

template with asset library #8

Closed getSurreal closed 13 years ago

getSurreal commented 13 years ago

I need help on the correct way to link my css and js files when using a template.

template is working using the below structure, but I'm not clear on how to specify a theme for the asset. asset is also working when not using template

/application -/themes --/default ---/views ----/css -----style.css ----/layouts -----default.php

default.php contents

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<?php echo $template['title']; ?>

config/asset.php contains

$config['theme_asset_dir'] = APPPATH_URI . 'themes/'; $config['theme_asset_url'] = BASE_URL.APPPATH.'themes/';

philsturgeon commented 13 years ago

Why would you put your css into the views folder? It isn't a view, so put it in the theme folder.

getSurreal commented 13 years ago

My bad I mistyped the folder path above

/application -/themes --/default ---/css ----style.css ---/views ----/layouts -----default.php

But at this point it doesn't matter because when I look at the source of the page rendered the asset library is generating this path /application/assets/css/style.css

So my original question is how to make the asset library use the theme path

philsturgeon commented 13 years ago

theme_css() theme_img() theme_js()

getSurreal commented 13 years ago

That was the simple piece I was missing. Thanks!

It appears that my theme is being detected as NULL though. Should I specify the theme differently than what I have below in order to pass it asset?

    $this->template
        ->set_theme('default')
        ->set_layout('default')
        ->set('heading','Test Heading')
        ->set('footer','Test Footer')
        ->build('test');