bob_marely Posted January 25, 2010 Share Posted January 25, 2010 I have this problem which I really don't know how to solve… it's really wired and I've tried so many ways then I thought that a different view might reveal something I didn't notice. So… I have six divs in my php page with display style = none, except the first div which is visible. I have buttons which their onclick event change the display of the divs, i.e. make one div visible and the others invisible. It works like magic except for the second div where it also includes the php file from the third div. Of course that snap code is always better than words: <div id="1" style="width: 950px; display: block"> <?php include('file1.php'); ?> </div> <div id="2" style="width: 950px; display: none"> <?php include('file2.php'); ?> </div> <div id="3" style="width: 950px; display: none"> <?php include('file3.php'); ?> </div> <div id="4" style="width: 950px; display: block"> <?php include('file4.php'); ?> </div> <div id="5" style="width: 950px; display: none"> <?php include('file5.php'); ?> </div> <div id="6" style="width: 950px; display: none"> <?php include('file6.php'); ?> </div> And this is the code for the onclick event: <a href="javascript:void(0);" onclick="includefile(1); return false;" > <img name="child" border="0" src="images/child.gif" width="180" height="30" /></a> There are six buttons like this one with different gifs and each button include different file. I tried many things – change the order, replace the included files, create new files, etc. but the bug still remains: always when changing the second div visibility it includes also the file in the div below it (I checked the display style of the third div and it remains none – it's just the third file is included under the second div). Sorry for the long story – I wanted to be clear and I believe that knowing all the details may help for having some ideas. Thank you for any advice!! Link to comment https://forums.phpfreaks.com/topic/189704-include-file-linked-to-other-file/ Share on other sites More sharing options...
gwolgamott Posted January 25, 2010 Share Posted January 25, 2010 Maybe it's a browser issue? Have you checked this in another browser to make sure that the browser is just not misinterpreting something from the css part. I think this is either a javascript or css issue with a browser. I don't think there is any php issue here. This is a CSS issue with a browser or at least it sounds like it. Even if this repeats itself in multiple browsers I'd try wrapping you div in inside a wrapper div.... Try something in that manner... <div id="WRAPPER" style="width:1050px"> <div id="1" style="width: 950px; display: block"> <?php include('file1.php'); ?> </div> <div id="2" style="width: 950px; display: none"> <?php include('file2.php'); ?> </div> <div id="3" style="width: 950px; display: none"> <?php include('file3.php'); ?> </div> <div id="4" style="width: 950px; display: block"> <?php include('file4.php'); ?> </div> <div id="5" style="width: 950px; display: none"> <?php include('file5.php'); ?> </div> <div id="6" style="width: 950px; display: none"> <?php include('file6.php'); ?> </div> </div> <!-- End of wrapper DIV --> Link to comment https://forums.phpfreaks.com/topic/189704-include-file-linked-to-other-file/#findComment-1001314 Share on other sites More sharing options...
jl5501 Posted January 25, 2010 Share Posted January 25, 2010 You say in your text that only the first div is visible initially, but you clearly have the div with id=4 also visible 2 things to remember, which you seem from your text to be unsure about. 1) all the include files will be included when the file runs on the server before the page is transmitted. 2) the visibility change will just change the visibility, not the inclusion of the php files. Link to comment https://forums.phpfreaks.com/topic/189704-include-file-linked-to-other-file/#findComment-1001317 Share on other sites More sharing options...
bob_marely Posted January 27, 2010 Author Share Posted January 27, 2010 Thanks for the replys! The visbility of div 4 is also 'none', it's just a typo... Anyway - I validated the generated html file and found out that some div was not closed correctly... At least it solved now! Link to comment https://forums.phpfreaks.com/topic/189704-include-file-linked-to-other-file/#findComment-1002265 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.