• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dreamweaver php template - wrong include path

Engaged ,
Dec 17, 2018 Dec 17, 2018

Copy link to clipboard

Copied

I have a php template under root/template which is working as expected.

it has the following 'require_once' files :

<?php

require_once '../_scripts/functions.php';

require_once '../_scripts/pageMake/menuItems.php';

?>

<!doctype html>

<html lang="he" dir="rtl">

<head>

<!-- TemplateInfo codeOutsideHTMLIsLocked="true" -->

    <meta charset="utf-8">

<?php

require_once '../_scripts/pageMake/head.php';

The problem is that when i try to create a new php file from this template it get the wrong paths to these files:

When I create the new file, before savings the paths look like this:(I only show the include files)

require_once 'file:///C|/My%20Doc/Google%20Drive/DnD/Bootstrap_4/_scripts/functions.php'; 

require_once '../_scripts/pageMake/menuItems.php';

require_once 'file:///C|/My%20Doc/Google%20Drive/DnD/Bootstrap_4/_scripts/pageMake/head.php';

And after saving: (I only show the include files)

require_once '_scripts/functions.php'; 

require_once '../_scripts/pageMake/menuItems.php';

require_once '_scripts/pageMake/head.php';

It gets some of the paths wrong - in this case "../_scripts/pageMake/menuItems.php" should be "_scripts/pageMake/menuItems.php"

If i change the files order, e.g.

require_once '../_scripts/pageMake/menuItems.php';

require_once '../_scripts/functions.php';

I know get:

require_once '_scripts/menuItems.php'; 

require_once '../_scripts/pageMake/functions.php';

What is going on here and how to fix this so that all path will be generated correctly?

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Dec 18, 2018 Dec 18, 2018

Ok,

I manages to solve this, so i hope as follows:

I have different root for html links and as follows:

function phpRoot()

{

    $host = $_SERVER['HTTP_HOST'];

$docRoot = $_SERVER['DOCUMENT_ROOT'];

if(strpos($host, "dnd-production.com") !== false){

#$site_Root = "http://$host";

$site_Root = $docRoot;

} else {

    $uri  = explode("/", $_SERVER['PHP_SELF']);

//print_r($uri);

$site_Root = "$docRoot/$uri[1]/";

}

return $site_Root;

} //phpRoot

function htmlRoot()

{

    $host = $_SERVER['HTTP_HOST'];

if(strpos($host, "d

...

Votes

Translate

Translate
Engaged ,
Dec 18, 2018 Dec 18, 2018

Copy link to clipboard

Copied

thank you

no i do not have any alias.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2018 Dec 18, 2018

Copy link to clipboard

Copied

so I think that the problem is there... your XAMPP server doesn't point to the right location...

2 solutions... you should try to have your web site located in an appropriate root.

A - move your web site in the native htdocs XAMPP folder

or B - create an alias... I think that creating an alias should be the more easy way to go...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 18, 2018 Dec 18, 2018

Copy link to clipboard

Copied

Are you sure this is how it works?

I have 3 testing servers under xampp/htdocs.  i created the folders DnD_B4, DnD_Responsive & TEST myself and specified it in DW

i can't move all of them under the same root?

or am i doing something wrong when specifying the path in DW?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

the one that you show in message #23.. indicate a different location

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

You are right - the latter shows a different testing server with the same structure as the on on message#23.

instead of DnD_Responsive it is DnD_B4.

i want to know if i set it properly in regard to the fact that i did not specify the actual root for the xampp folder.

I create a new folder for my testing server, in this case under xampp/htdocs/DnD_Responsive

I set the settings for the testing server as sows on message #27

Ta

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

I keep my local site folder inside my testing server's default web directory.  When I save a file, it's automatically saved to the testing server.  Nothing to push and no duplicate files.  See screenshot..

CC-testingServer1.jpg

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

Thanks,

That is a new approach no? Certainly not what to manual says.

Still, do you specify a testing server in your case? if yes what settings do you use for it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

This is how I have always set up my PHP environment.  I never understood why the help manual suggests duplicating folders.  It's not necessary.

My testing server is defined the same as yours.

CC-testingServer3.jpg

CC-testingServer4.jpg

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

OK,

I see the point - it sure saves space.

Are you sure, in your case, that wamp cannot alter anything.

After all you will be uploading these files to the remote live server.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

My testing server is a mirror image of my remote server. 

Wamp doesn't alter anything.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

LATEST

nope it's not a new approach,

Nancy point at a way to work if you're alone to work on a web site, local and testing server can be the same, just because you're alone...

as soon as you work in a team, you can't have local file and testing server being the same without causing trouble to others member of the team...

that's why manuals indicate two different folders... one for your local and personnal files and one to be share by the entire team and being the testing server... in theory then, only the project leader will have as local file the testing server, and as distant files the remote production server... so he or she can publish files when everything is ready to be pushed...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines