We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 48359
    • 22 Posts
    I have a modx site online im trying to get to run locally.

    I have copied all the dir contents across and changed the config files - the site is loading but its just text - no css or anything.

    Im trying to get this to run locally so I can make some changes / fixes and put it back onto the live server.

    Do I need the folders next to docs or can I just ignore those and drop everything inside docs into the www root? (im not doing that now - im just curious)

    Any ideas? I have cleared the cache, updated the config files and db names, and altered the htaccess files to reflect the localhost.com instead of the live domain - Also imported the sql file into the local db..

    Server is linux, im on xampp / windows.

    Thanks

    [ed. note: smashingred last edited this post 12 years, 2 months ago.]
      • 48359
      • 22 Posts
      oh - this is ModX Revolution 2.2.14.
        • 39404
        • 175 Posts
        stalemate resolution associate Reply #3, 12 years, 2 months ago
        If you look at the generated html, my guess is that the CSS and JS files aren't being loaded because you need to change your base url or because the directory structure is somehow different.

        Hope that helps.

        Regards,
        Tom
          • 48359
          • 22 Posts
          ok my bad- i found it in the config file, but the documentation is confusing to me - its a fwd slash, i have this:

          $site_url = 'http://localhost.com/testsite/';
          $base_url = '/';
            • 39404
            • 175 Posts
            stalemate resolution associate Reply #5, 12 years, 2 months ago
            In your template, you should see something like this:

            <base href="[[++site_url]]" />

            that should pick up the site_url setting.
              • 48359
              • 22 Posts
              where / how do i find my template? I cn see the path in the source but what file am i looking for? sorry im new to this -
                • 39404
                • 175 Posts
                stalemate resolution associate Reply #7, 12 years, 2 months ago
                Hi fstarocka,

                Welcome to the community!

                In the MODX manager, there are different tabs on the top left: Resources, Elements and Files.

                Your web pages will go in Resources, and each page optionally has a template it can use. Templates are in the Elements tab. If the page you're looking at in manager doesn't have the full HTML start and end tags, see which template that page uses (it's to the right of the title) and then look at that template.

                btw, there are many great resources to learn about MODX, and they are detailed here:
                www.discovermodx.com

                Regards,
                Tom
                  • 48359
                  • 22 Posts
                  cool thanks - ive been pulling my hair out trying to figure this out.

                  I copied the dir across exactly, updated te conf files as per the tut, imported the database and updated the htaccess rewrite domain to reflect the local -

                  How much more complicated can it be? plus the documentation is ambiguous -

                  "If you are also moving your site into or out of a subfolder, be sure to update the variables such as $modx_connectors_url, $modx_manager_url, and $modx_base_url. They should generally
                  end with a slash (e.g., $modx_base_url='/' for a site not in a subfolder)."

                  imo everything is in a subfolder at some point, with absolute paths and relative paths mixing around this is confusing..

                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Absolute URLs begin with a / to indicate the web root. In your case (and mine, on my localhost with lots of installations in subdirectories) it would need to be /subdir/. Absolute PATHS begin at the computer's file system root, in your case d:/ (and mine just /).

                    Relative paths or URLs are relative to... whatever is looking for the items. In the case of MODX, it's relative to the index.php file. All MODX action begins with that index.php file (in the case of the Manager, with the manager/index.php file). So a relative URL to MODX would be like assets/theme/site.css, since assets is right next to the main index.php file.

                    You need to open the core/config/config.inc.php file and make sure all of the paths and URLs are pointed to the correct directory. I use an editor with search-and-replace, because there are several places where those need to be changed. Especially check near the bottom, because that's where the assets path and URL are set, and that's where your .css files and images are usually kept. In my localhost, for example,

                    $modx_assets_path= '/Applications/MAMP/htdocs/test-dev/assets/';
                    $modx_assets_url= '/test-dev/assets/';

                    Yours would be

                    $modx_assets_path= 'd:/xampp/htdocs/testsite/assets/';
                    $modx_assets_url= '/testsite/assets/';

                    Keep in mind that a PATH is for the computer's filesystem, while a URL or URI is for the web server's web space (what's in the htdocs, public_html or www directories).


                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 3749
                      • 24,544 Posts
                      Have you tried just running Setup on the local install? That will often straighten out all the paths and URLs. If you have to re-create the setup directory, be sure to use a copy from the exact same version of MODX.

                      Some other possible things to do:


                      • Manually delete all files in the core/cache directory
                      • Clear your browser cache and cookies
                      • Check the value of the path in the modx_workspaces table in the DB.
                      • While you're in the DB, change the value of compress_js and compress_css in the modx_system_settings table from 1 to 0.
                      • Also in the modx_system_settings table, set the friendly_urls setting to 0 and rename any .htaccess file in the site root. That will turn off FURLs and take that issue out of the equation.

                      If Setup doesn't do it, also check the paths in the three config.core.php file (root, manager directory, and connectors directory).

                      The thing in the docs about "If you are also moving your site into or out of a subfolder" refers to the MODX site itself -- whether it is in the server's htdocs directory (or the equivalent), or in a subdirectory. If it's in a subdirectory and you're using friendly URLs, you usually want to have the subdirectory name in the Rewrite Base line:

                      Rewrite Base /subdirectoryName/


                      You'll also need to adjust the paths and URLs in config.inc.php and the config.core.php files, but Setup will usually do that for you (not always -- I've had to hard-code some of them when moving to localhost).

                      Finally, let me mention SiteCheck: http://bobsguides.com/sitecheck-promo.html. It will check all the paths and URLs for you (and a lot of other stuff). It's not free, but it's handy to have around.




                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting