PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, July 26, 2022

[FIXED] How to fix inlcude_once showing php as output only error in dreamweaver?

 July 26, 2022     css, dreamweaver, html, php     No comments   

Issue

I'm building a website on Dreamweaver using PHP and its only the start of it. include_once doesn't show the image. It only shows PHP in the design tab.

I've tried include also but that is also not working. I've tried for other files too, still the same problem.

<!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>The Pickzone</title>
  <link rel="stylesheet" href="style/style.css" type="text/css" media="screen" />
</head>

<body>
  <div align="center" id="mainWrapper">
    <?php include_once('template_header.php');?>
    <div id="pageContent">test</div>
    <?php include_once('template_footer.php');?>

  </div>

Solution

Try adding __DIR__ in front of your includes to provide the full path on the disk. E.g. /var/www/path/to/file/on/disk/.

<?php include_once __DIR__ . 'template_header.php';?>
<div id="pageContent">test</div>
<?php include_once __DIR__ . 'template_footer.php';?>

See the php documentation for more information.



Answered By - Tom
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing