phrozenflame Posted December 29, 2006 Share Posted December 29, 2006 I have learnt include "" , I have some questions about this.What is this for, to keep people from being able to see the source code, and if so why. I also noticed if you put in a url like<?phpinclude "http://www.w3schools.com";?>For instance it loads the webpage, but not the graphic files and pictures for it, are there situations where one might need to pull an outer website into there website for some reason like this,I also noted if you try and do something like this<?phpinclude "http://www.w3schools.com";include "http://www.gamefaqs.com";include "http://www.phpfreaks.com";include "http://www.php.net";?>for instance, then it loads each webpage onto the php page, but one after another and they always stack, like the w3 schools would be on top, below that the gamefaqs would start, after that and it keeps going, is there ever a point for anything like this. Link to comment https://forums.phpfreaks.com/topic/32135-help/ Share on other sites More sharing options...
trq Posted December 29, 2006 Share Posted December 29, 2006 [quote]is there ever a point for anything like this[/quote]Not really. include is designed so you can place reusable code into a file then include it where you might want to use it. To include entire webpages you would be best to use another method. Link to comment https://forums.phpfreaks.com/topic/32135-help/#findComment-149138 Share on other sites More sharing options...
phrozenflame Posted December 29, 2006 Author Share Posted December 29, 2006 Ok thanks for the help Link to comment https://forums.phpfreaks.com/topic/32135-help/#findComment-149141 Share on other sites More sharing options...
play_ Posted December 29, 2006 Share Posted December 29, 2006 yea. well ill give more information i guess.I use include to include header and footer on my pages.For example, instead of every page having[code]<?phpob_start();?><!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><script language="javascript"> if (document.all) document.onselectstart = function () { return false; };</script><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><link rel="stylesheet" type="text/css" href="styles/black.css" /></head><body><div class="container"> <div class="header"> <div class="logo"></div> </div> <!--/header --> <div class="menu"> <ul><!-- margin-left: -20px --> <li><a href="index.php" style="padding-left:0;">Paste</a></li> <li><a href="recent.php">Recent Pastes</a></li> <li><a href="#">About</a></li> <li><a href="#">Add-Ons</a></li> <li><a href="#">Search</a></li> </ul> </div> <!--/menu -->[/code]I put all that in a file called "header.php" and then on every pae, i use include('./header.php'); (saves me the trouble of copying and pasting that whole code on every page, and it looks much cleaner) Link to comment https://forums.phpfreaks.com/topic/32135-help/#findComment-149146 Share on other sites More sharing options...
phrozenflame Posted December 29, 2006 Author Share Posted December 29, 2006 so what would the purpose of taking strings out of a specific file without pulling the whole file Link to comment https://forums.phpfreaks.com/topic/32135-help/#findComment-149191 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.