chordsoflife Posted January 19, 2009 Share Posted January 19, 2009 I like to code in XHTML 1.0 Strict... for whatever reason. I'm building my first substantial web application, so I'm running into a few things I've never had to deal with before. Right now my issue is how many different external files I load in my header file and include in every page. It feels wrong to me to include so many different things that I don't use on a particular page, and it seems equally crazy to if statement them in for the particular pages I need them on. Is there a correct way to organize and include these kinds of things? Quote Link to comment https://forums.phpfreaks.com/topic/141512-basic-question/ Share on other sites More sharing options...
revraz Posted January 19, 2009 Share Posted January 19, 2009 How do you determine if you need them? If you don't use it, then why do you include it? Not sure what you are asking us to do.. Quote Link to comment https://forums.phpfreaks.com/topic/141512-basic-question/#findComment-740742 Share on other sites More sharing options...
DeanWhitehouse Posted January 19, 2009 Share Posted January 19, 2009 Do you mean how do we have include files and make sure that we don't include something we don't need, simple in the include file (header or whatever) just put something that you will need on all pages, and everything else on the page in question. Now if you have something on more than one page but not all then make a function for that and put it in the include file. Quote Link to comment https://forums.phpfreaks.com/topic/141512-basic-question/#findComment-740749 Share on other sites More sharing options...
chordsoflife Posted January 19, 2009 Author Share Posted January 19, 2009 Hm, let me try to be more clear. My header file has everything up to the page div. Typical. The page itself has whatever it needs. The footer file has the page close div and beyond. If I have one page that requires some js in a script tag (just that ONE page), I can put it on the page that needs it, but it's below the /head tag, which invalidates the page. To put it in the head tag, it would have to be in the header file, which means it would load unnecessarily for all the other pages. So lets say I have 20 unique pages that all use 20 unique bits of JS. Now I've got a 19 scripts loading for a page that don't need to be. Is it correct to put each one in an if statement so if page = whatever load this script? Quote Link to comment https://forums.phpfreaks.com/topic/141512-basic-question/#findComment-740762 Share on other sites More sharing options...
DeanWhitehouse Posted January 19, 2009 Share Posted January 19, 2009 You don't have to put JS in the head tags, you can place them anywhere Quote Link to comment https://forums.phpfreaks.com/topic/141512-basic-question/#findComment-740767 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.