BrettHartel Posted December 7, 2012 Share Posted December 7, 2012 Each of my webpages use the include file for a menu that I can easily maintain. I want to include a css.style link with my menu. Will that work properly or should I echo and print it in the menu.php If anyone has a link to a tutorial on this I would love for you to post it! Quote Link to comment https://forums.phpfreaks.com/topic/271722-can-i-include-a-document-within-an-included-document-cssstyle-sheet-in-menupp-in-webpagephp/ Share on other sites More sharing options...
Beeeeney Posted December 7, 2012 Share Posted December 7, 2012 I'm not sure what you're asking but I think that the answer is yes. You can just do the ol' fashioned link to stylesheet at the top of each of your files. You can include 100 files within another 100 files if you want. Quote Link to comment https://forums.phpfreaks.com/topic/271722-can-i-include-a-document-within-an-included-document-cssstyle-sheet-in-menupp-in-webpagephp/#findComment-1398126 Share on other sites More sharing options...
BrettHartel Posted December 7, 2012 Author Share Posted December 7, 2012 Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/271722-can-i-include-a-document-within-an-included-document-cssstyle-sheet-in-menupp-in-webpagephp/#findComment-1398129 Share on other sites More sharing options...
Christian F. Posted December 8, 2012 Share Posted December 8, 2012 (edited) If you're talking about adding the <link rel=""> tag inside the menu, which is in the body, then know that this is indeed invalid HTML. So while it should not work it may for some, depending upon their browser and its version. (Plus some other conditions outside of your control.) Thus it's a very uncertain method, and it will almost definitely lead to headaches later on. In any case, what I'd do, if I were you, is to add make the header and footer for the pages into their own file(s) as well. Then include the content (or them themselves). That'll ensure that all the pages uses the same structural framework as everything else, and will give you only one location which you need to edit to update this. If you make it so that the content files are included you'll get one entrance file for your site, "index.php", in which you'll have to retrieve and validate the name of the page the visitor wants to see. Then do all of the processing that you need to do for said page, before you write out all of the HTML to the browser. This is by far the most flexible method, even though it requires a bit more work and knowledge up front. The other method, of having separate files for the header and footer means that you only need 2 lines on each content page. Perfect for small & simple sites that don't need to do any real processing of data, but too inflexible to be used for pages that needs to have a high degree of dynamic content. That is, unless change the approach to read the header and footer content to a variable. Which you then, as with the first method, write out with the rest of the HTML content once all of the processing is done. Problem with that method, is that you'd have to repeat a lot of code across files if you wanted to extend this flexibility to other pages as well. Edited December 8, 2012 by Christian F. Quote Link to comment https://forums.phpfreaks.com/topic/271722-can-i-include-a-document-within-an-included-document-cssstyle-sheet-in-menupp-in-webpagephp/#findComment-1398203 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.