ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Path for templates assets

June 15, 2011 12:34pm

Subscribe [3]
  • #1 / Jun 15, 2011 12:34pm

    chiste

    18 posts

    This question may be related to a resolved thread.

    I have successfully make my homepage template works fine but when I create a template for a different channel, it wont render correctly using the same relative path I have used for my homepage.

    It only works if I change it to an absolute path.

    Is this the correct behavior?

    Will it be fix if I remove index.php from the URL?

    Thanks for your support.

  • #2 / Jun 16, 2011 6:57am

    John Henry Donovan

    12339 posts

    Hi chiste,

    it wont render correctly using the same relative path I have used for my homepage.

    Can you explain this a bit more with examples of the URLS you are trying to use.

    Do you mean in the browser or something to do with creating a link in your template code itself?

  • #3 / Jun 16, 2011 9:39am

    chiste

    18 posts

    Sure

    Here is a screenshot http://bit.ly/kdlaca

    As you can see I have structure my templates in 4 folders: site, noticias, maquinaria and includes

    In the includes.group folder I have reusable code like my header, footer, sidebar and main navigation.

    I use index.html on the site.group folder for my homepage and templates on the noticias.group for my news, both groups share the same reusable code in the includes folder.

    As you can see on line 40, of my document_head include, I need to change my CSS link to an absolute path so it will work properly. If I change it to a relative path removing the initial slah / my home page renders correctly, but neader of my internal pages will.

    This works on the home page, but not in other pages.

    <link rel="stylesheet" href="_/css/main.css" />
  • #4 / Jun 16, 2011 9:59am

    Sue Crocker

    26054 posts

    Hi, chiste.

    When it comes to external .css files and images, you always path from the root.

    So try:

    <link rel="stylesheet" href="/css/main.css" />
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases