Jump to content

help with include() function..??


naveenbj

Recommended Posts

Hi pals,

 

Thanks for reading my post!

 

Actually I have one header.php file and I have included it in index.php file from include() function,Im not sure why but the content of the header.php is not coming on index.php file.

 

When I checked the source I got this

 

<?= include $_SERVER['DOCUMENT_ROOT']."header.php";
?>
<table width="927" border="0" align="center" cellpadding="0" cellspacing="0" class="maintable">
  <tr> 
    <td> 
........

 

and this is my header.php file

 


<html>
<head>
<title>fulllogic :: DESIGN AUTOMATION</title>
<link rel="stylesheet" href="global.css" type="text/css">
<!--meta http-equiv="content-type" content="text/html;charset=utf-8"-->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen">
	<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
	<script type="text/javascript" src="js/hoverIntent.js"></script>
	<script type="text/javascript" src="js/superfish.js"></script>
	<script type="text/javascript">

	// initialise plugins
	jQuery(function(){
		jQuery('ul.sf-menu').superfish();
	});
	</script>

<script src="js/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<table width="927" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td> 
      <table width="100%" border="0" cellpadding="0" cellspacing="0" height="100">
        <tr> 
          <td width="35%"><a href="index.php"><img src="images/logo.jpg" width="207" height="100" hspace="10" border="0" alt="Welcome to fulllogic Design Automation"></a></td>
          <td width="65%" valign="top" align="right"><a href="resource_library.php" class="top_navigation">Resource Library</a> 
	  <a href="events.php" class="top_navigation">Events </a><a href="news.php" class="top_navigation">News</a></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td colspan="2" height="30"><table width="100%%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="52%"> </td>
        <td width="48%"><ul class="sf-menu">
		<li class="current">
			<a href="index.php">Home</a>
		</li>
		<li>
			<a href="products.php">Products</a>
                <ul>
                	<li><a href="nano_interactive.php" title="NanoRV Interactive">NanoRV Interactive</a></li>
                    <li><a href="visual_drc.php" title="VisualDRC">VisualDRC</a></li>
                    <li><a href="visual_lvs.php" title="VisuaLVS">VisuaLVS</a></li>
                </ul>
		</li>
		<li>
			<a href="support.php">Support</a>
                <ul>
                    <li><a href="login.php" title="Download Center">Download Center</a></li>
                </ul>
		</li>
		<li>
			<a href="corporation.php">Corporation</a>
                <ul>
                    <li><a href="executive_team.php" title="The Executive Team">The Executive Team</a></li> 
            		 <li><a href="board.php" title="The Board">The Board</a></li>
		 		 <li><a href="about.php" title="About fulllogic">About fulllogic</a></li>
		  		 <li><a href="careers.php" title="Careers">Careers</a> </li>
                </ul>
		</li>
            <li>
			<a href="contact.php">Contact Us</a>
		</li>	
	</ul></td>
      </tr>
    </table> 
      
    </td>
  </tr>
</table>

 

I tried sm other ways but not able to find out for the reason..so please help me on this.

 

Thanks & Regards!

Link to comment
https://forums.phpfreaks.com/topic/155046-help-with-include-function/
Share on other sites

Only use full php tags <?php

 

BTW: <?=, if it was working on your server (which is why you don't use short php tags), means <?php echo. You don't echo an include statement as that would output a true/false 1/0 number to the browser depending on if the include worked or not.

Only use full php tags <?php

 

BTW: <?=, if it was working on your server (which is why you don't use short php tags), means <?php echo. You don't echo an include statement as that would output a true/false 1/0 number to the browser depending on if the include worked or not.

 

Hi thnks for reply.

 

I have tried the way you told but the index page is still not taking the header.php part ..

 

any idea?

You are probably getting a php error concerning an incorrect path. Are you testing your code on a system with error_reporting set to E_ALL and display_errors set to ON so that php will help you?

 

$_SERVER['DOCUMENT_ROOT'] does not contain a trailing slash /, so you must supply one yourself before the file name -

 

include $_SERVER['DOCUMENT_ROOT']."/header.php";

You are probably getting a php error concerning an incorrect path. Are you testing your code on a system with error_reporting set to E_ALL and display_errors set to ON so that php will help you?

 

$_SERVER['DOCUMENT_ROOT'] does not contain a trailing slash /, so you must supply one yourself before the file name -

 

include $_SERVER['DOCUMENT_ROOT']."/header.php";

 

Hi PFMaBiSmAd

 

Im getting no error while running the page.This is what I get while checking the source from view source option

 

<?= include $_SERVER['DOCUMENT_ROOT']."header.php";
?>
<table width="927" border="0" align="center" cellpadding="0" cellspacing="0" class="maintable">
  <tr> 
    <td>...rest page code 

 

so the main issue is its not taking the include() function..Im not sure y and im getting crazy :(

 

Thanks!

Now I have made few changes and now in firefox im gettting the source code while executing the page...

 

<?php include ("header.php") ; ?>

<table width="927" border="0" align="center" cellpadding="0" cellspacing="0" class="maintable">
  <tr> 
    <td> 
      <div align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="930" height="237">
          <param name=movie value="flash/home_flash.swf">
          <param name=quality value=high>
          <param name="wmode" value="transparent" />
          <embed wmode="transparent" style="z-index: 0;" src="flash/home_flash.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="930" height="237">          </embed> 
        </object>
      </div>
    </td>
  </tr>
  <tr> 
    <td height="10"></td>
  </tr>
  <tr> 
    <td> 
      <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
        <tr> 
          <td width="73%" valign="top"> 
            <table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td> 
                  <p><img src="images/main_top_curve.jpg" width="657" height="13"></p>
                </td>

 

Any idea guys????????????

If you are seeing raw php code in your browser from a .php file, either php is not installed correctly or you are not browsing to the file through the web server. Are you sure the file ends in .php and not .php.txt? Do any .php files work? What URL are you using in your browser?

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.