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

    I have a template I use to create hundreds of pages that are identical except for the text.

    Is there a way I can configure this template through modx to automatically assign the h1 tag to the first paragraph (which is actually the one-line header,) and h2 to the second paragraph, without having to do each page manually? I know it can’t be done via css, so I was wondering if modx could help!

    As always, all assistance is appreciated!

    - Cris
      • 3749
      • 24,544 Posts
      Sorry, I can’t think of any easy way to do it. The normal method would be to put that line in the LongTitle field and use this in the template:

      <h1>[*longtitle*]</h1>


      The only way I can think of would be to write a snippet that would get every resource, move the first paragraph to the longtitle field (and remove it from the content field), and save. This would be fairly easy in Revolution, but a little more difficult in Evolution.

      I guess you could also write a plugin to do it on-the-fly. That might be easier, but it would slow down the site.
        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
        • 5994
        • 46 Posts
        Thanks Bob!

        I think I’ll go ahead and use the longtitle for my header line, and use the <h1>[*longtitle*]</h1> to format it. Now....

        Is there a way I can configure that ’summary’ section (or some other area that’s already there) so that I can plug my next paragraph info in there, and then do something like <h2>[*summary*]</h2> with it?

        I’m using a template variable for this section right now, but it would be nice to get rid of it if I could.

        Thank you for the help!

        Cris
          • 8609
          • 607 Posts
          einsteinsboi Reply #4, 16 years ago
          Not much to configure I don’t think. Just plug your paragraph into the summary field and use <h2>[*introtext*]</h2>

          I’m typing this from memory but I believe that’s the tag for the summary field...
            • 5994
            • 46 Posts
            It certainly is. Thanks a million, Bob!
              • 5994
              • 46 Posts
              Sorry about that, Mary. I think I need some sack time... Anyway, the introtext worked perfectly. Thank you!

              - Cris
                • 8609
                • 607 Posts
                einsteinsboi Reply #7, 16 years ago
                Quote from: cristian at Sep 07, 2010, 09:42 PM

                Sorry about that, Mary. I think I need some sack time... Anyway, the introtext worked perfectly. Thank you!

                - Cris

                No worries, glad I could help smiley