-1

I have been trying to insert rotating banners on my site though js. For some reason I cannot insert more than one JS without them disappearing. When I view the js through a php it works fine. Here is an example

http://www.hificornershop.co.uk/banners/top.php

rotate.js is on my server and top.php has js code insert to read it

I have then displayed the php file through an iframe on my site but I find the iframe a pain. Is there anyway I can display the php file without an iframe, hopefully through html code I can copy into my site.

JJJ
  • 32,902
  • 20
  • 89
  • 102
user1443247
  • 23
  • 1
  • 5

1 Answers1

0

You can "display" a PHP file that outputs HTML by simply including it somewhere in your source.

<?php include "myfile.php"; ?>

By putting that somewhere in your page, whatever myfile.php outputs will get inserted in that spot. So, if you have a script that displays a random banner every time the page loads, you can include that file in your page and it should work.

sachleen
  • 30,730
  • 8
  • 78
  • 73
  • thanks for the reply. Just copied in . Nothing has appeard:/ but the link definately works – user1443247 Jun 09 '12 at 00:46
  • For security reasons you're not allowed to include remote URLs. The PHP file should be on the same server. If you really really really need to include remote files, you can turn on `allow_url_include` in php.ini although this is not advised. – sachleen Jun 09 '12 at 01:10
  • oh right thats a shame. Thanks for the advice though, certainly very helpful:) – user1443247 Jun 09 '12 at 01:21