1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 Loading of additional css files, and how to use Template Modifications on it?

Discussion in 'XenForo Questions and Support' started by SchmitzIT, Dec 1, 2013.

  1. SchmitzIT

    SchmitzIT Well-Known Member

    In PAGE_CONTAINER, css files are loaded. I'm using Luke Foreman's Kotomi add-on to then embed a third-party program within XenForo.

    However, the css file is loaded by directly calling .css, which using Kotomi means that it's looking for the css page within the current folder. I addressed that by adding a Template Modification that references the boardUrl and thus pretty much "hard-code" it to grab the right file.

    Now I'm having a minor issue where the non-default XenForo CSS is not properly loaded, and I'm hoping that I can somehow pull the same trick for that. I sidestepped the issue for now by hard-coding the call to the css I can see in the page's source, but obviously this is far from optimal (adding a new add-on would mean the line would have to be fixed again).

    In PAGE_CONTAINER, the following line appears:

    I assume that is a hook for adding all the additional CSS files from add-ons. Is there any way I could somehow have the board url automatically put in front of the css.php file reference there?
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    What is your actual template modification?
  3. SchmitzIT

    SchmitzIT Well-Known Member

    The one I made?

    I replace

    <link rel="stylesheet" href="css.php?css=xenforo,form,public&amp;style={xen:urlencode $_styleId}&amp;dir={$visitorLanguage.text_direction}&amp;d={$visitorStyle.last_modified_date}" />

    <link rel="stylesheet" href="{$xenOptions.boardUrl}/css.php?css=xenforo,form,public&amp;style={xen:urlencode $_styleId}&amp;dir={$visitorLanguage.text_direction}&amp;d={$visitorStyle.last_modified_date}" />
    <link rel="stylesheet" href="{$xenOptions.boardUrl}/css.php?css=Gritter,GritterEXTRA,footer_custom,moderator_bar,sonnb_xengallery_navbar_template,xfa_blogs_nav&style=1&dir=LTR&d=1385910561"/>
    The second line as you can see contains CSS files for several add-ons, and every time I'd add a new add-on with its own CSS, that line would have ben altered.
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    You are hard coding the add-on CSS. If you edit the template, does that have any effect?
  5. SchmitzIT

    SchmitzIT Well-Known Member

    Hmm? I'm not sure I understand what you mean?
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    Your replacement code hard codes several things. If you edit the template to add in he board URL, does it function the way you want?
  7. SchmitzIT

    SchmitzIT Well-Known Member

    Well, the first line does little more than adding the boardURL to the existing call to css.php in the template. That bit works wonderful. I'm mostly trying to figure out where in XenForo the additonal css is added.

    I'm guessing it's at the line:

    The extra css is hooked, but if I'd want to manipulate the generated URL to add the board-name, I haven't been able to figure out how to do this.

    Incidentally, could you shed some light onto why the PAGE_CONTAINER template is referring to css.php in the template, and not {$boardURL}/css.php to begin with?

Share This Page