Ruud Posted April 29, 2009 Share Posted April 29, 2009 I have no idea if it has something to do with HTML or PHP but could someone tell me why the include function is not working here. The file is stored as a .php. <div id="header"><table border="0" width="100%"><tr><td width="50%"><p><div id="tableleft"><img src="images/new.gif" width="50" height="50"><?php include("scroll.php"); ?></div></p></td><td width="50%"><p><div id="tableright"><a href="index.php">Male</a> | <a href="femindex.php">Female</a> | <a href="male/guestbook.php">Guestbook</a></div></p></td></tr></table> <img src="images/background.png" width="100%" height="150px"></div><!-- end #header --> Link to comment Share on other sites More sharing options...
jeffman Posted April 29, 2009 Share Posted April 29, 2009 If the page itself is downloading okay, but only the include file is missing, I have to ask what scroll.php looks like.Are you sure it's not a path problem? For this to work as you have it written, scroll.php has to be in the same directory as the calling document. Link to comment Share on other sites More sharing options...
Ruud Posted April 29, 2009 Author Share Posted April 29, 2009 If the page itself is downloading okay, but only the include file is missing, I have to ask what scroll.php looks like.Are you sure it's not a path problem? For this to work as you have it written, scroll.php has to be in the same directory as the calling document.Both files are in the exact same folder.This is the scroll.php file.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body><style type="text/css">ul,li{margin:0;padding:0}#scrollDiv{width:500px;height:25px;line-height:25px;border:#ccc 1px solid;overflow:hidden}#scrollDiv li{height:25px;padding-left:10px;}</style><script type="text/javascript" src="java.js"></script><script type="text/javascript">function AutoScroll(obj){ $(obj).find("ul:first").animate({ marginTop:"-25px" },500,function(){ $(this).css({marginTop:"0px"}).find("li:first").appendTo(this); });}$(document).ready(function(){ setInterval('AutoScroll("#scrollDiv")',6000)});</script> </tr> <tr> <td> <img src="images/index-en_06.jpg" width="198" height="29" /></td> </tr> <tr> <td colspan="2"> <table width="654" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="43"> <img src="images/index-en_07.jpg" width="43" height="32" /></td> <td width="600" class="hotnews"> <!-- START --> <div id="scrollDiv"> <ul> <li><a href="link" style="color: #cc0000; text-decoration: underline;">Newslink tester.</a></li> <li><a href="link" style="color: #cc0000; text-decoration: underline;">Putting in more news.</a></li> <li><a href="link" style="color: #cc0000; text-decoration: underline;">How many new subjects are possible?</a></li> <li><a href="link" style="color: #cc0000; text-decoration: underline;">There we go again.</a></li> <li><a href="link" style="color: #cc0000; text-decoration: underline;">Ragnarok Rules!</a></li> </ul> </div> <!-- END --> </td></body></html> Fun part is when I open scroll.php on it's own it works perfectly. Btw. looks like a junkyard at the moment I know need to rewrite some of the code and build the table correctly but that is not the issue at the moment far as I am aware. Link to comment Share on other sites More sharing options...
boen_robot Posted April 29, 2009 Share Posted April 29, 2009 The contents of the included file must be only the markup you need at that spot - not a whole HTML document.Cut down the included file (scroll.php) to: <script type="text/javascript" src="java.js"></script><script type="text/javascript">function AutoScroll(obj){ $(obj).find("ul:first").animate({ marginTop:"-25px" },500,function(){ $(this).css({marginTop:"0px"}).find("li:first").appendTo(this); });}$(document).ready(function(){ setInterval('AutoScroll("#scrollDiv")',6000)});</script> </tr> <tr> <td> <img src="images/index-en_06.jpg" width="198" height="29" /></td> </tr> <tr> <td colspan="2"> <table width="654" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="43"> <img src="images/index-en_07.jpg" width="43" height="32" /></td> <td width="600" class="hotnews"> <!-- START --> <div id="scrollDiv"> <ul> <li><a href="link" style="color: #cc0000; text-decoration: underline;">Newslink tester.</a></li> <li><a href="link" style="color: #cc0000; text-decoration: underline;">Putting in more news.</a></li> <li><a href="link" style="color: #cc0000; text-decoration: underline;">How many new subjects are possible?</a></li> <li><a href="link" style="color: #cc0000; text-decoration: underline;">There we go again.</a></li> <li><a href="link" style="color: #cc0000; text-decoration: underline;">Ragnarok Rules!</a></li> </ul> </div> <!-- END --> </td> And if you also need the <style> element, I suggest you make a separate include for it - one that would actually insert it into the head of the final document (if you include it in scroll.php as is now, it will work, but your code will be invalid). Link to comment Share on other sites More sharing options...
Ruud Posted April 29, 2009 Author Share Posted April 29, 2009 Boen Robot, I cutted down the included file like you suggested however it does not seem to change anything. And as far as the second part you mentioned I have no idea what you ment by that. Link to comment Share on other sites More sharing options...
jeffman Posted April 29, 2009 Share Posted April 29, 2009 Have you tried view source to see if the include material is showing up?I ask because the pieces you are putting together make incorrect HTML. Here's the code near the include. I'm adding indentation -- maybe it will clarify things: <tr> <td width="50%"> <p> <div id="tableleft"> <img src="images/new.gif" width="50" height="50"> <?php include("scroll.php"); ?> </div> </p> </td> Now, the first bit of HTML generated by your include file is a </tr> tag. THIS CANNOT BE. You cannot close a <tr> before you close any <td> elements inside it. There is also an open <div> and an open <p> inside the <td>. So we cannot close the <tr> because of them also.I don't know if this is THE problem, but it certainly is A problem. Link to comment Share on other sites More sharing options...
Ruud Posted April 29, 2009 Author Share Posted April 29, 2009 I tried cleaning up the code of the included file sins I presume that was what you mend but still no luck. It actually now sees the box where the items where scrolling in as a broken image link now. With that comes that you where right and the source code shows me the include function instead of hiding it. <script type="text/javascript" src="java.js"></script><script type="text/javascript">function AutoScroll(obj){ $(obj).find("ul:first").animate({ marginTop:"-25px" },500,function(){ $(this).css({marginTop:"0px"}).find("li:first").appendTo(this); });}$(document).ready(function(){ setInterval('AutoScroll("#scrollDiv")',6000)});</script><table width="654" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/index-en_06.jpg" width="198" height="29" /></td> </tr> <tr> <td colspan="2"><table width="654" border="0" cellspacing="0" cellpadding="0"></td> </tr> <tr> <td width="43"><img src="images/index-en_07.jpg" width="43" height="32" /></td> <td width="600" class="hotnews"><!-- START --> <div id="scrollDiv"><ul> <li><a href="link" style="color: #cc0000; text-decoration: underline;">Newslink tester.</a></li><li><a href="link" style="color: #cc0000; text-decoration: underline;">Putting in more news.</a></li><li><a href="link" style="color: #cc0000; text-decoration: underline;">How many new subjects are possible?</a></li><li><a href="link" style="color: #cc0000; text-decoration: underline;">There we go again.</a></li><li><a href="link" style="color: #cc0000; text-decoration: underline;">More news!</a></li></ul> </div><!-- END --> </td> </tr></table> Link to comment Share on other sites More sharing options...
jeffman Posted April 29, 2009 Share Posted April 29, 2009 So the code you posted just above ^ DOES show up in view source? Link to comment Share on other sites More sharing options...
Ruud Posted April 30, 2009 Author Share Posted April 30, 2009 So the code you posted just above ^ DOES show up in view source?Both show up in my view source while EasyPHP is running perfectly. Link to comment Share on other sites More sharing options...
jeffman Posted April 30, 2009 Share Posted April 30, 2009 Then the include statement is working.Can you post a link to the page? If not, please copy/paste all the code that the browser receives. Not the PHP files, but everything you see in "view source."It looks like you're using jquery. Just so you know, there may come a point where some of us have to back out of this discussion. I (for one) don't use jquery, so if the problem turns out to be with the jquery interface, you may need additional help.Right now, I'm hoping the problem is still in the way the base file and the include file get assembled -- that an HTML syntax error gets created that we can spot and fix. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.