-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
65 lines (46 loc) · 1.79 KB
/
README
File metadata and controls
65 lines (46 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
==UPDATE==
There is now a config item for an application-wide JavaScript include. This script will be placed after all other JavaScript includes.
This is my take on a template library for CodeIgniter. I've been using it for a while now, and I think I'm happy enough with it to share it. You can do things like add title segments, javascript/css includes, and configure a lot of things.
I've documented the files a bit, but if there are any questions feel free to ask.
This library assumes your assets layout is something like this:
_assets
css
js
img
Should be easy enough to figure out how to change if that's not the case. Here is an extremely basic example of how you could use this library:
class About extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->template
->add_title_segment('About Us')
->add_javascript('jquery.js')
->add_stylesheet('screen.css');
}
public function index()
{
$this->template
->add_title_segment('Overview')
->build('about/index');
}
}
Ideally, you would have a base controller for including things like the jQuery library and your screen.css file, but I was trying to keep the example brief. Here is an example template file:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<?php echo $meta_tags; ?>
<title><?php echo $title; ?></title>
<?php echo $stylesheets; ?>
</head>
<body>
<div id="container">
<?php echo $content; ?>
</div>
<?php echo $javascripts; ?>
</body>
</html>
TODO:
* Make config/template.php not required
Enjoy.