I need a php include snippet made so that i can include the following network bar into other files via php. http://www.askteens.net/top/headness.html I need a working code, if anyone can help it's much appreciated
You just need to add the code below where you want it to show. <?php include("http://www.askteens.net/top/headness.html"); ?> Just a note that while I was looking at your URL source, it has html, head and body tags so just make sure to get rid of that if you're adding the code above where there's already html, head and body tags otherwise you'll have duplicate set of tags. Click the link below for more info about the include function http://ca.php.net/include/
And that will work as long as the file with the include statement is at the top level of the website. If you have pages in folders they would have to use ../ to go back up to the top level. Like so: <?php include("../top/headness.html"); ?> PHP:
It could work. Really depends on how the structure of the website is setup. Given most sub domains are actually pointers to a folder off the main domain(which is the top level), its exactly what would be needed. If you have mp3.askteens.net and the directory structure was like so / /mp3.askteens.net /mp3.askteens.net/callingfile.php /top /top/filetoinclude.php With / being www.askteens.net, if you wanted to include a file from /top on mp3.askteens.net it would be include "../top/filetoinclude.php" But as always with includes, it depends on how your host has it set up. Some hosts it would require additional work, like on mediatemple.net. They have a screwy file setup for domains and subdomains. It would require so much effort to traverse directories it wouldn't make sense to include a domain file on a subdomain since they treat subdomains pretty much as independent sites. Now if the sub domain was hosted elsewhere it wouldn't work at all.
Here is another way to include a page remotely <?php $menu = file_get_contents("http://www.askteens.net/top/headness.html"); echo $menu; ?> PHP: