We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29525
    • 388 Posts
    Hi all

    First time trying to follow the tutorial for Dynamic CSS with TVs. http://wiki.modxcms.com/index.php/Dynamic_CSS_with_TVs

    It doesn’t seem to be able to find the document containing the CSS or its not reading it correctly. I know that tutorial was published in 2006, I presume it’s still valid?

    The code in the header of my document is:

    <link rel="stylesheet" href="[(site-url)] [~[*CSS1*]~]" type="text/css" media="screen" />

    The document is in a folder in the same directory as the home page.
    CSS1 is the name of the TV

    I believe I followed the instruction pretty carefully in setting up the TV and the document then entering the document number in the TV.

    Is this some sort of path problem? Any thoughts why it can’t see the CSS code?

    Thank you!
      www.terrybarthdesign.com
      • 25663 MODX Staff
      • 12,272 Posts
      Would need to see the definition of your TV, and the page IDs you’re trying to reference. It also looks like you’ve got a space between your [(site_url)] and your [~[*CSS1*]~] which I suspect would cause problems. As long as you have a base-href in your templates, the [(site_url)] shouldn’t be needed:
      <base href="[(site_url)]"></base>
      <link rel="stylesheet" href="[~[*CSS1*]~]" type="text/css" media="screen" />
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 29525
        • 388 Posts
        rthrash

        Thanks for the quick reply.

        I do have a base href in my head section:
          <title>[(site_name)] | [*pagetitle*]</title>


        and now have this:
        <link rel="stylesheet" href="[~[*CSS1*]~]" type="text/css" media="screen" />


        These changes didn’t resolve the problem.

        I’ve attached screen shots of the TV definition, the page ID and the TV selection in the document in which I want to apply the CSS.

        Thank you!

        I’m trying to attach some screen prints but I’m getting an error message that says a file by the same name has already been posted. I’ll keep trying.
          www.terrybarthdesign.com
          • 29525
          • 388 Posts
          I can’t seem to attach images for some reason. Here’s the info on my TV


          Template Variables

          Add or edit template variables here. Template Variables must be assigned to templates in order to access them from snippets and documents.

          Variable Name: [*CSS1*]
          Caption: CSS1
          Description: ID number of a CSS file (document)
          Input Type: Number
          Input Option Values:
          Default Value: @INHERIT
          Widget:
          Widget Properties
          Reset parameters

          Sort Order: 0
          Lock variable for editing Only Administrators (Role ID 1) can edit this variable.

          Template Access
          Select the templates that are allowed to access/process this variable

          MODxCSS Wide
          MODxCSS
          MODxHost
          MODxHostWithComments
          TerryBarthDesign1 - this is the name of the template I wish to apply the CSS file and it is checked

          Access permissions
          Select the document groups that are allowed to modify the content or value of this variable

          All Document Groups (Public) - this is checked
          Site Admin Pages
            www.terrybarthdesign.com
            • 29525
            • 388 Posts
            Here’s the Page ID info



            TerryBarthDesign
            Home (1)
            Blog (2)
            Request an Account (5)
            404 - Document Not Found (7)
            Search Results (8)
            RSS Feed (11)
            MODx Features (15)
            Getting Help (33)
            Template Examples (39)
            Design (32)
            [*loginName*] (4)
            [*loginName*] (37)
            Thank You (46)
            Contact Us (6)
            CSS (53)
            terrybarthdesigncss1 (54)
              www.terrybarthdesign.com
              • 25663 MODX Staff
              • 12,272 Posts
              A title tag is not a base href.

              Did you actually name the TV "[*CSS1*]"? It should be just CSS1 without the brackets and asterisks.

              If that doesn’t fix it then PM me a manager login and I’ll take a quick peek for you.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 29525
                • 388 Posts
                What a difference a day makes. . . New day, fresh eyes, easy answer.

                Turns out that my CSS document file was corrupted. When I looked at it today. I noticed there were a bunch of extraneous symbols in the content of the document. Probably happened when I pasted in the CSS code.

                So I recreated the CSS doc. Works like a charm! This is very cool.

                Thank you.

                Terry
                  www.terrybarthdesign.com