Forum Moderators: coopster
Im trying to learn and use SSI but as a newbie im so confused. I wonder which is best to use or is it all same thing?
@import
<?php require_once('header.html');?>
<?php require("header.htm");?>
<?php include('header.inc');?>
<?php include("includes/header.php");?>
<!--#include virtual="/includes/header.php"-->
include('http://www.mysite.com/includes/header.php');
The require [php.net] and include directives are almost identical except for the way they handle failure. Details in link.
SSI is really not necessary when you are using PHP. Yes, you could indeed use SSI along with PHP, but you really don't need to once you get a handle on the require() statement.
Personally, I almost exclusively use require_once() [php.net].
Actually i dont know php but my host dont allow me to use SSI with .html but .shtml (which i dont like that .shtml extension and prefered to have .php
I use dreamweaver and it use require_once() also and i understand that i can use require() too.
one more thing please, is it ok to use require() for my footer,header,nav bar,content etc. on the same page?
Thank you cooper
yes you can. That's the way I do it, as do a lot of us.
maybe this thread about template has some examples that show how to use multiple include/require statements in a page
[webmasterworld.com...]
I will ask question later about your posts at that useful topic after i find where am i :(
i will try to explain, i use dreamweaver and it gives me the code below as default .php page
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head><body></body></html> Is this code good to start for a newbie? or is there any other suggestions.
After, iam adding my external.css
<link href="1.css" rel="stylesheet" type="text/css" /> in the body i have;
<div id="header"><?php require('includes/header.php');?></div> Now what is the full default code should be in my header.php?.Simply i wanna have image link to my logo in it but im lost about the code i tryed some but didnt worked can someone please tell me whats the full code should be in my header.php .My image link is root/phptest/images/logo72854.png :(