We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36926
    • 701 Posts
    Basically what i want is a snippet of html for special offers on a page.


    So i have some code i want to reproduce several time on a page, depending on how many special offers are available.

    So say i have some code for example:


    <div class="specialOffer">
    <div class="specialTitle"><h3>Title of item</h3></div>
    <div class="image"><img src="image of item goes here" /></div>
    <div class="specialDescription">Description of item goes here</div>
    </div>
    So say i have 3 items on special offer then that will be generated 3 time. If 6 items are on offer then it will be generated 6 times. for example:
    <div class="specialOffer">
    <div class="specialTitle"><h3>Plasma Screen</h3></div>
    <div class="image"><img src="plasma.jpg" /></div>
    <div class="specialDescription">panasonic 50" plasma</div>

    <div class="specialTitle"><h3>DVD Recorder</h3></div>
    <div class="image"><img src="dvd.jpg" /></div>
    <div class="specialDescription">Panasonic DVD Recorder</div>
    </div>
    Where would the users enter the details like title, dscription and image. And how would i get it to loop thru to see how many items the user has listed.

    Please note this wont be using a shopping cart or anything at the moment.

    Note sure where to start with this.

    Any help or advice would be much appreciate.

    Thanks in advance

    Ben



      • 22303 MODX Staff
      • 10,725 Posts
      You can easily create each item as a document, then use Ditto to summarize them using that markup as a starting point for your Ditto template. Then you can use other Ditto features, like showing random articles.
        • 36926
        • 701 Posts
        Quote from: OpenGeek at Mar 16, 2008, 12:53 PM

        You can easily create each item as a document, then use Ditto to summarize them using that markup as a starting point for your Ditto template. Then you can use other Ditto features, like showing random articles.

        Thanks for the rely, not used ditt yet as thought it was just for blogs and stuff. I will check it now.

        Thanks

        Ben
          • 7231
          • 4,205 Posts
          as thought it was just for blogs and stuff.
          Ditto is the swiss army snippet for displaying document information. You can do anything from a photo gallery to a news index to RSS and ATOM feeds, it can filter, tag, sort documents, it has 100s of built-in features that can do almost anything...it dices, slices and even cuts through a tin can. grin

          Check out Ditto’s home page: http://ditto.modxcms.com/
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 36926
            • 701 Posts
            Quote from: dev_cw at Mar 16, 2008, 02:12 PM

            You can do anything from a photo gallery to a news index to RSS and ATOM feeds, it can filter, tag, sort documents, it has 100s of built-in features that can do almost anything...it dices, slices and even cuts through a tin can. grin

            Just checking it out now, as you mentioned it does so much, I’m just trying to get my head around exactly what call ect. i need to do this. But what i’ve read so far, this seems like a very powerful tool. This adds more flexibility to modx then i realized and i already thought modx was great cause of it’s flexibility. Thanks all for pointing me into the right direction. Hopefully wont get to lost in what ditto can do.

            Thanks

            Ben
              • 13740
              • 86 Posts
              Hi Ben,

              I’ve only been using ModX for a couple of weeks, and it took me a while to get my head around what Ditto and Template Variables can accomplish, but it’s well worth learning. I’ve already built 2 sites with it.
              Made sure you use WayFinder too!
                • 36926
                • 701 Posts
                Quote from: jbloggs2002 at Mar 16, 2008, 06:41 PM

                Hi Ben,

                I’ve only been using ModX for a couple of weeks, and it took me a while to get my head around what Ditto and Template Variables can accomplish, but it’s well worth learning. I’ve already built 2 sites with it.
                Made sure you use WayFinder too!

                Been using modx for a couple months and have been impressed with everything i’ve seen, including wayfinder and webloginpe. I actually spent a long time deciding what CMS to use and feel i have made the right decision. Every thing i’ve seen i’ve been so impressed but i’d never looked at ditto as as associated it with blogs, so glad was pointed in the right direction with this

                I’ve now been working on this for a few hours and have been very impressed what ditto can. But a couple of questions that have sprung to mind.

                Firstly an you get ditto to use different templates for different type of items in a list. So say for instance you have a list of items in a column, some are news items and some are promotions. And you use a tv dropdown to state if it a news item or promo item. Can these then be surrounded by different code depending on what type of item it is?

                Secondly is it possible to use different calls of ditto on a page and also specify if a page displays them or not. So using the news items and promotions example but this time they are separate ditto calls and you want to display both on some pages and one or the other on other pages.

                Thanks

                Ben