We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13740
    • 86 Posts
    I’m having trouble with the &cssTpl option - rather than simply inserting the code from the chunk, it inserts:

    <link rel="stylesheet" type="text/css" href="MY CHUNK CONTENT">

    I presume I’m doing something wrong, since I can’t find any other reports of this behaviour.

    The documentation specifically says "name of chunk containing css you would like added to the page", not "name of chunk containing PATH TO css you would like added to the page"

    Thanks for any help...
      • 5091
      • 332 Posts
      Hi, I just did the &cssTpl early in the morning, what I did is link my external style sheet like so in the chunk (css_menuTpl):

      <link href="/css/menu.css" rel="stylesheet" type="text/css"/>

      then in my Wayfinder call in the the template, I inserted this: "&cssTpl=`css_menuTp`

      Note, it may not be the case for you but just in case: I first used the <link href="[(base_url)]css/menu.css" rel="stylesheet" type="text/css"/> but it didn’t pick up my menu style sheet, so I changed it to relative path. I am working from local server, so that maybe the reason it’s not picking the [(base_url).





        • 7231
        • 4,205 Posts
        That’s odd since I just used it and it inserted the css in th header rather than create a reference to it. Hmmm. Maybe it acts differently to the format. The docs say it does both:
        &cssTpl
        default: FALSE
        values: name of CSS chunk
        description: The cssTpl allows for a chunk containing a link to a style sheet or style information to be inserted into the head section of the generated page.

        In my chunk I start with <style type="text/css"> and it works fine.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don&#39;t know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 13740
          • 86 Posts
          yup, that’s it - if it’s surrounded by <style type="text/css"> and </style> it inserts it, otherwise treats it as a link to the stylesheet - not explained in the docs.

          Thanks for the help!