We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8960
    • 150 Posts
    I’m trying to set a separate style (through CSS) for the first entry on a page vs. the rest of the entries on the same page. By entry, I mean posting, blog post, article, or whatever you want to call it. Let me see if I can explain this better:

    1st posting - blue background
    2nd posting - red background
    3rd posting - red background

    I’m NOT looking for the CSS code. I know CSS well. I want the entire first post on my page to have a different look, but in my template, the way I’m calling the posts up is the standard longtitle/content. If I use the longtitle/content twice on the template, it obviously just repeats itself. I’ve tried using Ditto, and I’ve come close, but it only partially works on some of the pages.

    Here’s a link to my original design: http://temple.campfiresites.com/

    Here’s how I was originally calling up my posts:
    <div id="main">
          <div id="highlight">
            <h1>[*longtitle*]</h1>
            [*#content*] 
    </div>
          <h2>[*longtitle*]</h2>
               [*#content*] 
    </div>


    So, the first entry gets styled with the CSS ID highlight. I want the rest of the entries to have a normal (unstyled) format. Again, I tried using Ditto but I could get the coding right. Any suggestions? I’m new to MODx, not to CMS’s, but if you tell me to use Ditto/NewsListing/Snippets/Chunks or anything else, I’ll need you to point me in the right direction with the coding.

    Thanks!!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Use Ditto, with the argument &tplFirstRow=`chunkName` where chunkName is the name of a chunk with the template for the first item.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 8960
        • 150 Posts
        Thanks Susan!! This is why I’m switching to MODx. Fastest. Forum. Response. Ever.

        That seems to work great, but only for pages that start as folders (e.g. the Blog page from the default MODx install): http://temple.campfiresites.com/blog.html

        All the other pages give a parsing error.

        This is my Ditto call:
        [[Ditto? &summarize=`2` &total=`5` &tpl=`DittoDisplay` &tplFirstRow=`DittoHighlight` &showarch=`0` &truncLen=`10` &truncSplit=`0`]]


        Here’s the Chunks:
        DittoDisplay (for the normal styling):
        <h3><a href="[~[+id+]~]">[+title+]</a></h3>
        <h6>POSTED by <strong>[+author+]</strong> on [+date+]</h6>
        <div>[+summary+]</div>
        <p>[+link+]</p>


        DittoHighlight (for the highlighted styling):
        <div id="highlight">
        <h1><a href="[~[+id+]~]">[+title+]</a></h1>
        <div>[+summary+]</div>
        <p>[+link+]</p>
        </div>
        


        I tried substituting longtitle/content in for title/summary, but I still get the same parsing errors.

        Thanks, again!
          • 8960
          • 150 Posts
          If there’s already a template, or something along those lines, already available, please let me know. I don’t mind looking through code to find the answer. I just need a little tug in the right diirection.

          Thanks.
            • 11975
            • 2,542 Posts
            Hi,

            You have to specify a &startID in your ditto call.

            :-)
              Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
              • 8960
              • 150 Posts
              Quote from: heliotrope at Nov 13, 2006, 10:48 AM

              You have to specify a &startID in your ditto call.

              I actually had that in there before I posted here. The problem with defining the startID is that the startID would need to be different for each page. The homepage startID iis different than that of the Blog page and the Contact Us page. If I define the startID as document ID 1, then each page would begin with the Welcome message, right?
                • 11975
                • 2,542 Posts
                If the &startID is not set Ditto will use the current docID as default value.

                Did you write the ditto call in your template or inside a document content?

                :-)
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 8960
                  • 150 Posts
                  Quote from: heliotrope at Nov 13, 2006, 10:59 AM

                  If the &startID is not set Ditto will use the current docID as default value.

                  That’s why I didn’t include the startID. I wanted it to pick up the current document it was on.

                  Quote from: heliotrope at Nov 13, 2006, 10:59 AM

                  Did you write the ditto call in your template or inside a document content?

                  In the template. Is this the best place for that or should I create a Chunk or something to better handle the call?

                  Thanks.
                    • 11975
                    • 2,542 Posts
                    It really depends on the results you want to achieve.

                    If you want to select where to apply the ditto listing, there are several ways to do it.

                    Writing the call in the document content is the easiest way

                    you could also create a TV(type=listBox single for instance with several options value(a blank one, another one with a chunk name in which you write the ditto call) and then select the value for each document.
                    To display the result of your choice, you’ll have to replace the ditto call by the [*myTVname*] in your template.

                    The Tv options will look like something as follows:
                    blank==||ditto listing={{myChunkNameContainingDittoCall}}

                    Hope that makes sense.

                    My english is basic so I cannot explain as much as I would.

                    :-)

                      Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                      • 8960
                      • 150 Posts
                      I understood most of what you said. I’m still a MODx novice.

                      I’m not sure, though, that what you proposed would solve my current problem of not being able to display a page that is not a folder (e.g. the Home page, or any page under a folder). Basically, my Ditto calls are only working on pages that are marked as a folder.

                      Things work fine if I just use longtitle/content, or even a Ditto call that is just to one specific document (using the startID), but if I try to use Ditto as the only means to display content, that’s when I get my parsing errors.

                      Thanks.