Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Header Include with JQuery

Can anyone help? I was trying to create an Inc folder with a header.php file; however when I use the file, the jquery stuff stops working? I think it's because page 1 links to one type of jquery slider and page 2 links to another type of jquery sliders and I have different css files for different things. What a mess! ;)

Here's the question: Do i just make an exhaustive list of all the jquery links and css files add it to the header.php file OR can i simply not use header.php includes if I have multiple pages with different jquery elements and css elements? So maybe keep the header.php for the simply pages and just a la carte the other pages.

1 Answer

Kevin Korte
Kevin Korte
28,148 Points

If you go your second route, than everytime you'll need to update the menu, or some other common header, item, you'll have to make that change on every file, yuck.

How many CSS and JS files do you have? Each on of those is a server request, and therefor a hit to performance. You'd be better off turning all of your CSS files into one or two larger ones. And than think about moving the JS files to the footer.