Skip to main content
Participant
March 25, 2021
Question

Dreamweaver Localhost Setup

  • March 25, 2021
  • 3 replies
  • 1717 views

Hello Everyone, 

 

It has been some time since I used Dreamweaver. I am Web Development and Design student and don't know all of the details around servers yet. Anyhow, my assignment is to develop a CMS in PHP.  I purchased MAMP Pro to set up my development environment and set it up in a server called Localhost. MAMP uses the document root of Application/MAMP/to put all files to be rendered in the browser. When I opened up Dreamweaver the system allowed me the opportunity to choose where to set up my local files. I decided to set them up in htdocs as I should so that the files can be uploaded to the browser correctly. Or at least that is my assumption. However, I am questioning this because Dreamweaver also asked for the root of where the files should be placed. I also made the choice to have them all out in the root of the htdocs folder of MAMP. My question is should they be separate? As I am coding PHP the details are rendering fine in the browser but when I entered the line <link rel "stylesheets" media="all" href="../stylesheets/staff.css" /> and it should have linked the stylesheet staff.css from the stylesheets directory to index.php in the staff directory. Unfortunately, the CSS file did not render. I am wondering if this has to with the local files being located in the same root as server files. Maybe there is an issue for that reason. I included a screenshot from Dreamweaver on how the file structure is put together. Please let me know if you have any answers to this question. I need to get going on this project. Thanks. Regards, Greg.

    This topic has been closed for replies.

    3 replies

    B i r n o u
    Legend
    March 25, 2021

    if you ask 10 developers, you will get 10 different answers.
    None is better than the other, each one fits the various workflows based on the agency, team or solo work of the approach.


    Personally, I work with various structures and each time I have to adapt my own solutions.


    Often I have encountered the problem of path, root or not, and also related to the various configurations specific to each server, and also according to their configuration ...


    since I replace all my include, link and other paths by something like (i.e pure fictive exemple)

     

     

     

    <?php 
    	include_once('/'.trim( $_SERVER['DOCUMENT_ROOT'], '/' ).'/php/__SESSION__.php');
    ?>

     

     

    and all my src, href in the code HTML are relative to the root of the site.

     

    <link rel "stylesheets" media="all" href="/stylesheets/__staff.css" />

     

    I never encounter anymore any trouble

    my 2 cents

    Jon Fritz
    Community Expert
    Community Expert
    March 25, 2021

    All of my local root folders, for every one of my websites, reside in my local server installation's htdocs folder. Something like this...

    htdocs

       site1

          index.php

          everything else...

       site2
          index.html
          everything else...
       site3
          and so on

    ...if you're only ever going to have one site, putting the index.php file and the rest directly into the htdocs folder is fine.

    The way I do it allows me to use the address localhost/site1 or localhost/site2 to preview my sites from my local machine. I can also use my machine's local IP address/site1 or /site2 to view my sites from any other device on the same network, as long as the server is running.

     

    In the link: <link rel "stylesheets" media="all" href="../stylesheets/staff.css" /> it's showing that the "staff.css" file is inside a "stylesheets" folder that is one level above the current file. Essentially it would mean the page you are working on would need to be inside a folder that is on the same level with the stylesheets folder, something like...

    index.php
    pages
       thepage.php 
    stylesheets
       staff.css

    ..if you are working on your index.php page, in the same structure as above, the ../ would need to be removed from your stylesheet link, because there can't be a folder up one level from the index.php page, since that would take the file out of the publicly viewable htdocs folder.

    Participant
    March 25, 2021

    Hey, Jon that really helpful. So you said that the ../ needs to be removed so instead I would need this line in the <head></head> section.

    <link rel "stylesheets" media="all" href="stylesheets/staff.css" /> 

    I will try that and hopefully, that will work. It shows you what a newbie I am when it comes to development. 

     

    Thanks for all of the help again.

    Regards,

     

    Greg

    Participant
    March 25, 2021

    I saved but it still did not render.  Back to the drawing board. There must be something that I am doing wrong. More research required on what I am doing wrong here. 

     

    Thank you. 

    Participant
    March 25, 2021

    Oh, and the root directory of all of the files is Applications/MAMP/htdocs

     

    Screenshot attached below.

     

    Greg.

    Community Expert
    March 25, 2021

    I'm not really sure I understand what your end goal is, but with regards to the setup of a localhost, that should be your htdocs folder, or a subfolder of that if you intend on running multiple sites within your setup.  The other questions DW would ask about are a testing server, which can be your htdocs folder.  The remote server should typically be something that is not on your computer that you would want to transfer files to so they can be seen online.

     

    With regards to your site not rendering in live view, is your server running when you try to render?  Personally speaking when it comes to a CMS, unless you are doing develop (ie: plugins/addons/etc), you typically don't need to do any work in Dreamweawver as the data is contained in the database and accessible via the CMS UI.