jpmad4it Posted March 13, 2007 Share Posted March 13, 2007 Hello everyone, I am having trouble with an include file. The file that I am including in my web page controls a random flash banner rotator. All that you have to do is add the following to the page and the banner is displayed: <? php include("http://www.xxxxxxx.com/yyyyyyy"); ?> The problem I have is that the flash banner always appears at the very top of the page, but it should be appearing where it is told to, which is half way down the page within a table I have set out. I have tried the following but I get the same result: <?php $file = file_get_contents("http://www.xxxxxxxx.com/yyyyyyyy"); echo $file; ?> Can anyone help? Are include files automatically set to appear at the top of the page? Am I missing something? Any suggestions would be greatly appreciated. Regards Jp ??? Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/ Share on other sites More sharing options...
only one Posted March 13, 2007 Share Posted March 13, 2007 if you have it in a table check the td <td valign=top>... Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206123 Share on other sites More sharing options...
jpmad4it Posted March 13, 2007 Author Share Posted March 13, 2007 Hey, thanks ........ I checked that out but I'm afraid its not the problem ??? Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206125 Share on other sites More sharing options...
monk.e.boy Posted March 13, 2007 Share Posted March 13, 2007 post a link to your page. monk.e.boy Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206134 Share on other sites More sharing options...
jpmad4it Posted March 13, 2007 Author Share Posted March 13, 2007 www.xxxxxxxxxxxxxx.com/xxxxxxxxxx/upload/ EDIT: The banner should appear under the wording: 'Welcome to the Goodgreef shop' Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206137 Share on other sites More sharing options...
AndyB Posted March 13, 2007 Share Posted March 13, 2007 One look at the HTML source of your page shows that the included banner is ahead of EVERYthing - even before your html file's opening. The problem is in the html/php code where you have added the include. Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206138 Share on other sites More sharing options...
kenrbnsn Posted March 13, 2007 Share Posted March 13, 2007 Please post the PHP script between tags. Ken Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206139 Share on other sites More sharing options...
ToonMariner Posted March 13, 2007 Share Posted March 13, 2007 its because you have it outputting data before any of your html. all you need to do is place the <?php $file = file_get_contents("http://www.xxxx.com/banners"); echo $file; ?> inside a suitable element in your site. where ever you want it to display simply put that bit of code inside the relevant td tag Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206140 Share on other sites More sharing options...
jpmad4it Posted March 13, 2007 Author Share Posted March 13, 2007 Its very hard to explain how its all set out. I guess anyone familiar with the Cubecart software would know best. The following code is included in the english language folder, in a file which is called home.inc.php, so I guess that its an include file in its own right. It has the follwoing code: <?php $home['copy'] = '<p align=\"center\"><strong><font size=\"3\">CHECK THIS OUT........ INTRODUCING<br/> GOODGREEF's BRAND NEW "MADE TO ORDER" PRODUCT RANGE</font></strong></p> <p align=\"center\"><font size=\"2\">The Goodgreef Team have come up with yet another ingenious idea. This gives you loyal clubbers a chance to get hold of certain items that we have not been able to offer before! So what are you waiting for! Check the items out today!</font></p>'; $home['copy'] = '<p align=\"center\">' ?> <?php include("http://www.goodgreef.com/banners"); ?> <?php '</p>'; $home['enabled'] = '1'; $home['title'] = 'Welcome to the Goodgreef Shop'; ?> I can't even start to think to explain how it all works!! I'll have to have a look and see if I can try to explain it. regards jp Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206146 Share on other sites More sharing options...
kenrbnsn Posted March 13, 2007 Share Posted March 13, 2007 The problem is this line: <?php $home['copy'] = '<p align=\"center\">' ?> <?php include("http://www.xxx.com/banners"); ?> <?php '</p>'; ?> I believe what you are trying to do is put the contents of the included file into the array. The following should do that: <?php $file = file_get_contents("http://www.xxx.com/banners"); $home['copy'] = '<p align=\"center\">' . $file . '</p>'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206148 Share on other sites More sharing options...
jpmad4it Posted March 13, 2007 Author Share Posted March 13, 2007 The problem is this line: <?php $home['copy'] = '<p align=\"center\">' ?> <?php include("http://www.xxx.com/banners"); ?> <?php '</p>'; ?> I believe what you are trying to do is put the contents of the included file into the array. The following should do that: <?php $file = file_get_contents("http://www.xxx.com/banners"); $home['copy'] = '<p align=\"center\">' . $file . '</p>'; ?> Ken SUPERSTAR! It works. Thanks! EDIT - ahhhh now I can only have the banner OR the text in that array, and not both ??? EDIT2: I fixed it guys. Thanks for the help .......... ***** five star rating! Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-206152 Share on other sites More sharing options...
jpmad4it Posted March 28, 2007 Author Share Posted March 28, 2007 Solved :-) Link to comment https://forums.phpfreaks.com/topic/42488-why-do-files-using-the-include-function-always-appear-at-the-top-of-the-page/#findComment-216663 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.