We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6437
    • 157 Posts
    Hello there,

    I seem to be missing something with template set up in ModX Revo and am wondering if there’s a way to solve the problem.

    I’m creating content for the <head> section of a document in a Chunk, to avoid duplication across templates - however I want to add additional JS/CSS scripts to the <head> chunk on a per template basis.

    I assumed the logical way of doing this would be to create TVs for "Additional-JS" and "Additional-CSS" give them a location within my <head> Chunk and then assign a default value on a per template basis, but this doesn’t seem possible? I was hoping this would provide the flexibility to override on a per template and a per resource basis.

    Is there a way to work around this?

    Cheers,

    Steve
      • 28215
      • 4,149 Posts
      Use a Template’s Properties.

      IOW, give them template a property of ’cssUrl’ with a value of ’assets/css/my.css’ or whatever, and then in your Template’s code:

      <link href="[[+cssUrl]]" rel="stylesheet" type="text/css" />
      
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 6437
        • 157 Posts
        Thanks splittingred - funnily enough I figured this out and was just about to reply with my the same proposed solution.

        Quick question - are there any plans to change the Property entry dialogue boxes depending on field type? i.e. Text Area is a little on the narrow side.

        Thanks again,

        Steve