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

    I was working on a self-made CMS for a client when I suddenly discovered Modx, which impressed me a lot!

    I have a couple of questions. I looked in the forum and I couldn’t find an anwser, so sorry if there’s already an answer for this.


    I have a general template which is the same for the entire site, however, within a small content area, I will need to use different text styles and margins/etc for that text (different classes) - homepage uses a class for the text, page B uses another class for the text and so on... The layout is the same (background etc...) but the text styles, spaces, etc are different.

    I could solve this creating a new template for each page but that’s not a good solution. Is there a turn around for this? The only thing that is different for each page is the content (text, maybe an extra image...) in a small Content area.


    My last question is about the text/rich text options that appears when creating a TV. On my CSS, I defined that inside the block Y, the <p> tag will be orange. Then I created a TV for the text inside that block with Rich text option selected, however, when I write the text on my page using that TV, the text stays black with no style applied, if I change the TV to just text, the style is applied (stays orange). The problem occurs when I want to apply for example bold text to my text (only Rich text allows this). Is there any way to solve this? This needs to easy for the client (no html)


    Sorry for my first long post.


    Thank you in advance.

    Kind regards.
      • 4172
      • 5,888 Posts
      1. you can create radiobutton-TVS for different styles
      options: styleA||styleB||styleC or styleA==A||styleB==B||styleC==C

      in your template:
      <div class="[*mystyleTV*]">
      [*content*]
      </div>
      


      2. you can create different chunks for your styles
      chunk-example:

      <div class="styleA">
      [*content*]
      </div>
      <div class="styleX">
      [*richtextTV*]
      </div>


      radiobutton-TV with this options to choose your chunk: chunk A=={{chunkA}}||chunk B=={{chunkB}}.........
      in your template for example:

      <div id="contentarea">
      [*chunkTV*]
      </div>


      3. configure your RTEditor with predefined templates: http://modxcms.com/forums/index.php?topic=30069.0

      of course there are more ways todo what you want and you are free to mix and combine these methods depending on your needs.

      wellcome to modx!
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 3749
        • 24,544 Posts
        The way you’re doing it sounds like a perfect case for TV-Based Chunks: http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks.

        Basically, you’d put the code for the special sections in a bunch of chunks, all assigned to the same category. Then create a TV that will automatically show a drop-down list of those chunks on each page when you edit it so you can just select one.

        BTW, I would be inclined to do the reverse of what you’re doing and use the same classes on every page but insert a different CSS file for the different pages. I’d use a small CSS file with just the classes for that section of the page. The whole point of CSS is not having to change the HTML to get the desired effect.

        You can inject a CSS file into the top of the page in a MODx snippet with:

        $modx->regClientCSS('path_to_css_file');
          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
          • 25679
          • 37 Posts
          Hi,

          Thank you both for your answers.

          I will try your ideas as soon as I got home. I will give you feedback about it later.

          Thanks again.


          Kind regards.
            • 25679
            • 37 Posts
            Hi,

            Thank you once again for your help.

            I’m having some hard time trying to achieve what I want. I can’t use the CSS method due to the fact that this must be clean for the client. If the client decides to add another page, that method will not work because the client don’t really know what to do.

            The method of creating a TV/chunk list to choose from is not functional I guess; I will need 5,6 ... different chunks with different styles, then select the desired chunk, and then adding the text and images on the associated TV (something that I couldn’t get to work).. in the end the edit page will be a mess with so many TV. This is for a client that have no knowledge of any kind of coding and wants it clean (open edit page and start filling the text spaces with the content).

            Without other solutions, I’ll need to build 3 more templates just for that.


            Maybe I’m just still a bit confused with the Modx work system.



            Regarding the Rich text/text TV question, I’m a little bit confused due to the fact that it started working... I can add any text in my editor because now my CSS text style is being applied. Is this some kind of bug? I removed and added a new page. It wasn’t working on the previous page.
              • 3749
              • 24,544 Posts
              I don’t know what to tell you. It sounds like what you want to do will be complicated for the client no matter what method (or CMS) you use.

              Maybe separate templates is the better way to go. There’s a way to make new documents inherit the template of their parent, which might help.
                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
                • 25679
                • 37 Posts
                Hi,

                I will make separate templates and you probably right... it is the best "solution".


                Thank you


                Kind regards.