FireWhizzle Posted June 19, 2009 Share Posted June 19, 2009 After crawling around this site and a few others I am resorting to making a post asking a question (AHHH!). Situation: I have php file A, which includes php file B. php file A loads a *.css file in the header and formatting is correctly applied. php file B however does not inherit the formatting from the *.css file applied to php file A. What I've derived: If I write the link to the *.css file in B I cannot get it to format correctly. In the case stated one line above, if I go to php file B in a browser directly, not by including it in php file A, the formatting of course works correctly. Question: Is this an issue with using the include function or must it be an error in php file B? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
FireWhizzle Posted June 19, 2009 Author Share Posted June 19, 2009 Here posted are links to php file A and php file B, as well as active code snippets of question. Link to php file A including php file B: http://www.actorchrisadams.com/index.php?page=video index.php code snippet: <?php $page = $_GET['page']; if($page == 'headshots') { include 'headshots.php'; } elseif($page == 'video') { include 'video.php'; } elseif($page == 'voiceover') { include 'voiceover.php'; } elseif($page == 'resume') { include 'resume.php'; } elseif($page == 'contact') { include 'contact.php'; } else { include 'uc.html'; } ?> Link to php file B standalone: http://www.actorchrisadams.com/video.php video.php code: <HTML> <HEAD> <LINK HREF="main.css" REL="stylesheet" TYPE="text/css"> </HEAD> <BODY> Test 123 </BODY> </HTML> Quote Link to comment Share on other sites More sharing options...
akitchin Posted June 19, 2009 Share Posted June 19, 2009 it's because you're opening/closing HTML tags several times in the two files. is there a reason why they're standalone HTML pages, and yet one is being included within the other? Quote Link to comment Share on other sites More sharing options...
FireWhizzle Posted June 19, 2009 Author Share Posted June 19, 2009 it's because you're opening/closing HTML tags several times in the two files. is there a reason why they're standalone HTML pages, and yet one is being included within the other? You have most likely just solved my dilemma. I am somewhat inexperienced with nested pages, as I have only built one site previously and it was years ago. I will give this a try and update for reference to others. I changed video.php aka php file B to this: Test 123 The links up top are updated for reference. The font formatting still isn't applying correctly. The correct formatting is like that of the bottom copyright line. Thoughts? Quote Link to comment Share on other sites More sharing options...
akitchin Posted June 19, 2009 Share Posted June 19, 2009 it's because you're opening/closing HTML tags several times in the two files. is there a reason why they're standalone HTML pages, and yet one is being included within the other? You have most likely just solved my dilemma. I am somewhat inexperienced with nested pages, as I have only built one site previously and it was years ago. I will give this a try and update for reference to others. with nested pages (or included sections), you will usually want to have the "container" file hold all the parental HTML data such as the html, head, and body tags. the included files themselves should only contain data pertaining to the physical section of the site they are meant to represent (if that makes sense). Quote Link to comment Share on other sites More sharing options...
FireWhizzle Posted June 19, 2009 Author Share Posted June 19, 2009 Non-relevant info was here. Quote Link to comment Share on other sites More sharing options...
FireWhizzle Posted June 19, 2009 Author Share Posted June 19, 2009 Actually, I think it might be that although I defined the body text parameters in the *.css file, I did not define default table class parameters. Giving that a shot. Problem solved, above was the solution. Quote Link to comment 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.