Welcome Guest, Not a member yet? Register   Sign In
Head Library
#1

[eluser]adamfairholm[/eluser]
I've been developing almost exclusively in CodeIgniter for 2 years now, and I love it. I've never released a piece of code before, but wanted to give back to the CI community in any way possible, so hopefully someone will find this useful. There may be other libraries that do what this class does, but I haven't found anything that does it exactly the way I like it to.

The Head Library is basically a library to easily create the content in the <head> tags through the controller, and through default values stored in a config file. For a while I would have a view for the <head> of the document, and as time wore on, it would inevitably be a mess of if statements and other nightmarish stuff. I developed this library to keep projects under control in the <head> department.

Here are some of the key features:

<b>Packages</b>
Often times, some code or plugin you want to use comes in multiple files. The Head Library has support for packages, which are named arrays of files that go along with those packages. The Head Library resolves multiple instances of duplicate files from different packages.

<b>JQuery Support</b>
The Head Library has special considerations for those who loves them the JQuery. Blocks or lines of code can be added anywhere, and they are all added under the document.ready function in the head.

<b>Support for Everything I Could Think Of</b>
Meta tags, JS, CSS, the base tag, misc code, the title tag, inline CSS and JS, XML/Atom links - everything I could imagine that could go into the &lt;head&gt; is here. If I didn't put it in, let me know!

I've written out some pretty thorough documentation here:

http://www.adamfairholm.com/head_library

I've also created a Google Code page for the files and issue tracking and all that good stuff (in reality, I really just wanted to create a Google Code page. It's pretty cool).

http://code.google.com/p/codeigniter-head-library/

I'd appreciate any feedback or thoughts of any kind. I've tried to make this library as flexible and useful as possible, and its been a huge time saver in several larger projects I've worked on. Hopefully someone will find it useful.

Like I said, this is my first piece of code out in the wild, so go easy on it!
#2

[eluser]Phil Sturgeon[/eluser]
Snazzy, I like it! When I first saw the post I LOLed but this is actually a very handy piece of work. Much cleaner syntax.
#3

[eluser]RaZoR LeGaCy[/eluser]
This is quite nice. Anyone else have any thought on this library.
#4

[eluser]Tom Schlick[/eluser]
[quote author="Phil Sturgeon" date="1257120140"]Snazzy, I like it! When I first saw the post I LOLed but this is actually a very handy piece of work. Much cleaner syntax.[/quote]

im sorry to say i did the same thing but this is actually quite useful!! thanks a lot man!
#5

[eluser]adamfairholm[/eluser]
Thanks for the positive feedback, guys. Much appreciated. I've always though CI needed more sexually suggestive library names.

Phil - I put a link to your &lt;base&gt; tag article in the documentation. I didn't know about the &lt;base&gt; tag for so long but it's so useful, especially for CI.
#6

[eluser]tonydewan[/eluser]
Thanks for contributing! This is very thoroughly documented! One thing to consider, for the sake of performance, would be doing some kind of pre-processing and/or combining of your JavaScript and CSS. It can be pretty astounding how much impact loading several external resources can have on your page loads. Take at look at Carabiner (linked in my sig) for how I deal with this.

Otherwise, nice first contribution.
#7

[eluser]adamfairholm[/eluser]
Do you mean there is something that causes slow performance in the code, or is just the fact that loading different resource impacts page load in any situation, regardless of whether you are using a library to create the &lt;head&gt; tags?
#8

[eluser]tonydewan[/eluser]
Just that loading multiple resources impacts page load. Essentially, the idea is to limit the size of objects sent to the browser (for obvious reasons), but also to limit the number of actual requests. There are two reasons: 1 that HTTP requests are 'expensive' (take a lot of time). 2nd, much more importantly, is that browsers will only download up to 2 items simultaneously. So, not only is each HTTP request time consuming to do, but it also adds to the loading time of every other asset below it in the queue. This counts for everything that the browser is downloading, by the way, including images (both inline and referenced in CSS), favicons, JS, CSS etc.

Hope that helps.
#9

[eluser]dansmith65[/eluser]
Thanks for this library. I am new to CodeIgniter, and I have had difficulty learning how to manage assets; this made it easy though!

I found I wanted a few more features than your library already offered, so I modified it. You can download my version of the library here: http://github.com/dansmith65/CodeIgniter-Head-Library.

There is a change log on the github page, and I updated the documentation to reflect my changes.




Theme © iAndrew 2016 - Forum software by © MyBB