Skip to main content
Known Participant
April 16, 2018
Answered

Server Side Include PHP Dreamweaver CS 6 Can't get the paths right

  • April 16, 2018
  • 1 reply
  • 13682 views

Ok I am trying to place my menu in using a SSI.   This use to work I managed to break it cleaning up temnplates

I can no longer find a way for DW to update my Include path in PHP files

I came across this discussion in my quest

"Server-side includes" equivalent in DW CC

and in that I found what i hoped would be the golden apple with this

<?php require_once('includes/my-include-file.php'); ?>

I tweaked this to

<?php require_once('Includes/Navigate2.php'); ?>  to reflect my site   (yes  my older  directories start with Caps)

Fatal error: require_once(): Failed opening required 'Includes/Navigate2.php' (include_path='.:/usr/local/share/pear') in /usr/local/www/kasdivi.com/pages/Travel/HongKong/Aberdeen/Jumbo.php on line 111

Ok tweak again  and tried the absolute path

<?php require_once('http://kasdivi.com/Includes/Navigate2.php'); ?>

and

Fatal error: require_once(): Failed opening required 'http://kasdivi.com/Includes/Navigate2.php

and   tried this to get auto path that works on the css files  (soort about the yellow  I am too old to figure out how to turn it off)

<?php require_once('../Includes/Navigate2.php'); ?>

and yes same error

Fatal error: require_once(): Failed opening required '../Includes/Navigate2.php' (

So   I hand edited the relative path to  

<?php require_once('../../../../Includes/Navigate2.php'); ?>

and everything work great

So I guess this means I broke templates in DW 6?

This topic has been closed for replies.
Correct answer Nancy OShea

The default location for a DW template is inside the Templates folder.

SiteName (C:\SiteName)

about.php

contact.php

index.php

     CSS

     Scripts

     Images

     Includes

     Templates

          main.dwt.php

1 reply

BenPleysier
Community Expert
Community Expert
April 16, 2018

I am assuming that you have placed the include file in the template. If this is correct, then you are defeating the purpose of an include file.

If you intend to keep using templates (there is nothing wrong with this) then you should not be using include files.

If the purpose is to get ride of templates, then the structure of your pages will be different. Have a look at the following scenario of a document

<?php

$pageID = '';

$title = '';

$description = '';

?>

<!DOCTYPE html>

<html lang="en-AU"> 

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<?php include_once('inc/meta.php'); ?>

<title>BoK | <?php echo $title; ?></title>

<?php include_once('inc/meta-social.php'); ?>

<?php include_once('inc/favicon.php'); ?>

<link rel="stylesheet" href="css/styles.css">

</head>

<body id="<?php echo $pageID; ?>">

<?php include_once('inc/header.php'); ?>

<?php include_once('inc/navbar.php'); ?>

<main>

</main>

<?php include_once('inc/footer.php'); ?>

<script src="js/scripts.min.js"></script>

</body>

</html>

.An example of an include file (media-social.php)

<meta property="og:url" content="<?php  echo $url; ?>">

<meta property="og:title" content="<?php echo $title; ?>">

<meta property="og:description" content="<?php echo $description; ?>">

<meta property="og:type" content="website">

<meta property="og:image" content="https://mysite.org/img/img-facebook.png">

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Known Participant
April 16, 2018

This is not quite the impression I  got from "Server-side includes" equivalent in DW CC    and until recently I had been successfuly using SSI in templates but I screwed soemthing and can't any more    But its probable just me screwing up.I have followed your approach and giving it a try.   DW CC Doesn't run that good for me on a Mac witrh 10.13  so I am going more and more back to <shudder> hand coding

Nancy OShea
Community Expert
Nancy OSheaCommunity ExpertCorrect answer
Community Expert
April 17, 2018

The default location for a DW template is inside the Templates folder.

SiteName (C:\SiteName)

about.php

contact.php

index.php

     CSS

     Scripts

     Images

     Includes

     Templates

          main.dwt.php

Nancy O'Shea— Product User & Community Expert