PDA

View Full Version : PHP Includes not showing


parishkj
05-16-2011, 05:48 PM
Converting a site from HTML templates to php using includes. Dreamweaver CS4 XAMMP on PC Linux on server. Multiple issues with include not returning code to page when on server. (OK for other php functions) Path set to relative and fine on PC preview.

Change to absolute and error in preview mode but work in a fashion on server. with 2 includes on the page seem to need to refresh for the second to show but then lose the first.

Site=www.pivingtonpots.co.uk

Relevant code

<!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=utf-8" />
<title>Pivington Pots home page. Pots and garden ironwork at affordable prices</title>
<meta name="Keywords" content="Pivington Pots, Pots, Pivington Mill, Kent, ironwork, decorative, garden, planters, terracotta, flower pots, " />
<meta name="Description" content="Huge Discounts from Pivington Pots who provide a wide range of flower pots and containers from end of range sources, at often less than 50%of the original price." />
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<div id="wrapper">
<!--- Start of Main Menu section --->

<div id="menubar">

<?php include("/includes/inc_menu.php"); ?>
</div>
<!--- End of Main Menu section --->

<div id="maincontent">

help please in words I can understand as a novice

Corrosive
05-16-2011, 07:14 PM
Why the extra forward slash?

Try;

<?php include("includes/inc_menu.php"); ?>

parishkj
05-16-2011, 07:22 PM
the inc,menu item is in the directory 'includes' which is located at the site root level

so location is root/includes/inc_menu.php

The page with the problem is also located at root level.

thanks for looking

ken

Corrosive
05-16-2011, 07:42 PM
Ok, so as I posted, change your code.

parishkj
05-16-2011, 08:00 PM
Thanks a million guessued it was something silly and simple but looked at so long this afternoon was losing the thread.

Impressed by the rapid response as well so once again thanks


Ken

Corrosive
05-17-2011, 06:58 AM
Thanks a million guessued it was something silly and simple but looked at so long this afternoon was losing the thread.

Impressed by the rapid response as well so once again thanks


Ken

Ha, ha. We all have 'wood for trees' moments with code. Glad it is fixed :)

Maxbeta
08-08-2011, 12:13 PM
I have a problem connected to this thread.

I use the includes as described earlier in the thread. No problem there.

"includes/menu.php"

But what if the page is located deeper in the hierarchy like this?
root/somefolder/mypage.php

The menu is here
root/includes/menu.php

If I use "../includes/menu.php" the web browsers will find the included file and everything works fine. But Dreamweaver can not show the file in Design View in this case. But if I activate Live View then Dreamweaver will show the included file.

What is the correct way to do this so the same code works both live and in the Design View?

pwolfe
03-07-2012, 12:07 PM
Relevant code

<!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=utf-8" />
<title>Pivington Pots home page. Pots and garden ironwork at affordable prices</title>
<meta name="Keywords" content="Pivington Pots, Pots, Pivington Mill, Kent, ironwork, decorative, garden, planters, terracotta, flower pots, " />
<meta name="Description" content="Huge Discounts from Pivington Pots who provide a wide range of flower pots and containers from end of range sources, at often less than 50%of the original price." />
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<div id="wrapper">
<!--- Start of Main Menu section --->

<div id="menubar">

<?php include("/includes/inc_menu.php"); ?>
</div>
<!--- End of Main Menu section --->

<div id="maincontent">

help please in words I can understand as a novice

That is actually a very relevant code the only problem is that I do not know where it has to be placed. :( I have this subheading called flowers delivered today (http://www.serenataflowers.com/Flowers-delivered) but I do not know how I can place the relevant code right beyond the subheading and before the pictures. :(