We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2234
    • 2 Posts
    Please excuse my ignorance but I am confused with getting this done.
    I can build standard sites and have been using different CMS systems but I just cant grasps this.

    I want to add a CSS document to the template so I can start the style.

    I search over google and the forums and found 2 articles.

    http://wiki.modxcms.com/index.php/Dynamic_CSS_with_TVs
    Which is outdated.
    and then
    http://modxcms.com/forums/index.php/topic,625.0.html
    Which just did not help at all.

    I tried
    <link rel="stylesheet" type="text/css" href="[~3~]" />

    and get
    <link rel="stylesheet" type="text/css" href="[~3~]" /> 

    on the users end.

    Can someone please shine some light on what I am doing wrong. I am trying to use MODx but this is the draw back I am currently facing.
      • 33997
      • 150 Posts
      One solution: edit your CSS the old fashioned way. Put your CSS file into:
      assets/css/
      and then make your call as follows:
      <link rel="stylesheet" type="text/css" href="assets/css/yourstylesheet.css" />
      

      Otherwise, I don’t know that I can help you. It looks as though the docID is not being parsed. Are you using Evo or Revo? If you are using Revo, then it is an easy fix. Change your code to read:
      [[~3]]

      (I think that is right - I use Evo).

      hope that helps...
        "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
        • 2234
        • 2 Posts
        MODx Revolution 2.0.8-pl (traditional)

        I tried as you said.
        <link rel="stylesheet" type="text/css" href="[[~3]]" />


        Then she wrote
        <link rel="stylesheet" type="text/css" href="index.php?id=3" />
          • 3749
          • 24,544 Posts
          If you’re using Revolution, you can just put the path from the MODx site root to the CSS file in a TV called customCSS and use this tag:

                <link type="text/css" href="[[++site_url]][[*customCSS]]" rel="stylesheet" />


            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
            • 33997
            • 150 Posts
            And don’t forget the following (from the wiki page):

            The Settings
            So anyway, go create your CSS file wherever you want. Now you’re creating a document -- remember this -- so you need to set some specific options so that MODx will recognize it as a CSS document, not a HTML one.
            In Document Settings -> General, make sure that the file has an alias, and that it uses the (blank) template. Also, make sure that the "Show in Menu" box is unchecked. These settings are crucial for the css to work!
            Next, in Document Settings -> Page Settings, uncheck Rich Text?, Log Visits, and Searchable. In the Content Type select box, select text/css. And make sure that the document is published.
            Then save and continue on!
              "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
              • 3749
              • 24,544 Posts
              Note that the Wiki article assumes that you want to put the CSS in a MODx document, which is overkill IMO.

              In the method I’ve listed above, the CSS is in a file and you just put the path to the file in the TV. You can still use @INHERIT as the default value of the TV, so children will inherit the path from their parents by default.
                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
                • 33997
                • 150 Posts
                I usually just write all of my CSS files to a separate file, in the assets/css/ folder, and then for pages that need additional CSS, I have a TV that I apply to all templates called [*extraheadercalls*]. This allows me to add in calls to js, css, or whatever else I need to create custom styles for a page. Sometimes, I only need to add in one or two CSS rules, and I’ll type them right into the TV box. Works for me.
                  "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein