Tuesday, 9 June 2020

php header and footert

header and footer
It willl display in every page
in every html pages, some elements are common, so instead of creating in every page, we can create in one page , we can use that one in all pages
instead of writing in every page , can we write in all pages from one page
save file as headerinc.php
<?php
echo '<h1> telugu computer wold learn</h1>' ;
like a template
?>

page1
<?php
include 'headerinc.php';
in which page u require write like this , It will print that header inc file data
?>
<?php
require 'headerinc.php';
if headerinc file is not available ,It ells error and it will not execute after that code
echo 'this is a test para';
destroyed if file is not there
?>
<?php
include 'headerinc.php';
if headerinc file is not available ,It ells error and it will execute after that code
echo 'this is a test para';
?>
include once and require once
include '../headerinc.php';
if we write include once, then write include, it will execute, that’s the procedure
if we include only one time , it is useful
include_once '/headerinc.php';
require_once 'headerinc.php';
include_once 'headerinc.php';
it will display the values presnt in that file
include 'headerinc.php';
it will display the values presnt in that file
if we need same file we will use include_once
include 'headerinc.php';
only this file is execute
include_once 'headerinc.php';
it will not display
include 'headerinc.php';
it will display the values presnt in that file
include 'headerinc.php';
it will display the values presnt in that file

headerinc.php
echo
include
require
require
echo
include
include
include_once
require_once
include_once
include 
include
include_once



what is meant by header and footer
how can I write in one file , it will execute in all files without rewriting
whats is the use of use
is it prints statements after rquire? And why it not executes
what is the use of requeire where can we wirte
whatt is the differenece between require and include
how to check we include or not with include once
requireonce also same ainclude once

No comments:

Post a Comment