We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12793
    • 293 Posts
    Hi! I’ve copyed a templates on my server version .... this template works on my localhost

    but I can’t view CSS, images

    in template I’ve

    <link rel="stylesheet" type="text/css" href="[[++base_url]]assets/templates/memorial/style.css" />



    in HTML I show

    <link rel="stylesheet" type="text/css" href="/assets/templates/memorial/style.css" />


    Can you help me??

    Thanks
      • 22303 MODX Staff
      • 10,725 Posts
      The base tag in your HEAD (which is required in all MODx templates) should already point you to the base_url. You do not need to prefix your images or stylesheets with [[++base_url]].

      Also, if you transferred this to a server, did you run setup in upgrade mode so the cache is cleared and all the paths updated? Or you can manually delete all the files in core/cache/ to clear the cache, though other paths in settings may need to be manually updated.
        • 12793
        • 293 Posts
        Resolved.... problem with cache!!


        Thanks
          • 26016
          • 561 Posts
          Quote from: OpenGeek at Feb 24, 2010, 03:49 PM

          The base tag in your HEAD (which is required in all MODx templates) should already point you to the base_url. You do not need to prefix your images or stylesheets with [[++base_url]].


          That’s interesting... although I have worked on sites with Base tags in templates before, I almost never use them anymore. That’s actually one of the things that I like about MODx, it just "figures it out" on the hosts I’ve used. And so many things work with relative paths... my other vice, Wordpress, does not, which makes moving sites around a slight PITA. A WP newbie will blithely move their test site to the root, and boom, no more images in their content. MODx, heck, it doesn’t even care. smiley
            MODx and Wordpress development
            Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: samba at Feb 25, 2010, 03:11 PM

            Quote from: OpenGeek at Feb 24, 2010, 03:49 PM

            The base tag in your HEAD (which is required in all MODx templates) should already point you to the base_url. You do not need to prefix your images or stylesheets with [[++base_url]].
            That’s interesting... although I have worked on sites with Base tags in templates before, I almost never use them anymore. That’s actually one of the things that I like about MODx, it just "figures it out" on the hosts I’ve used. And so many things work with relative paths... my other vice, Wordpress, does not, which makes moving sites around a slight PITA. A WP newbie will blithely move their test site to the root, and boom, no more images in their content. MODx, heck, it doesn’t even care. smiley
            There are two reasons I always use a base tag in MODx templates:

            • Since MODx handles all virtual requests that are not actual files/folders on the web server, if the user requests foo/bar/ and MODx returns the error page, all paths will be relative to foo/ and your CSS and other paths will not work unless you use absolute paths from the web server document root. A base tag set to the site_url (which is automatically detected, as you mention) allows you to handle foo/bar/ as if it was at the root of the site instead of at foo. This is also critical when using the friendly_alias_path option creating virtual folders that are actually served from index.php at the site_url.
            • By making the browser understand that even though the URI is foo/bar/ that the base href of the page is at the site_url, you can move the site to any subfolder within the document root without any consequences. This is important for me so I do not have to setup virtual hosts in my local dev environment for every site I develop; I just put them in subfolders and they work the same as they would in the document root.
            Basically, by using the base tag, it makes your site content more portable, and prevents path problems with requests to virtual folder structures.