Jump to content

Help


phrozenflame

Recommended Posts

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
<?php
include "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
<?php
include "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

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]<?php
ob_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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.