We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12844
    • 59 Posts
    I’m still not too familiar with the way that chunks, TVs and snippets can all combine so I’m asking for a basic rundown of how I should incorporate the following feature please:

    At http://euro-racing.net/ you’ll see a ’Latest podium’ box in the top right, with my own placeholders for data. This is currently a chunk called {{RacePodiumLayout}} which is called from the template:

    <div class="featurebox">
    <h3>Latest podium</h3>
    <h6>[circuitname], [date]</h6>
    <p><img src="forum/Smileys/erg/1st.gif" alt="First place" /> [firstplacedriver]</p>
    <p><img src="forum/Smileys/erg/2nd.gif" alt="Second place" /> [secondplacedriver]</p>
    <p><img src="forum/Smileys/erg/3rd.gif" alt="Third place" /> [thirdplacedriver]</p>
    </div>


    This podium box will be displayed on all pages in the MODx site and should be the same on all.

    How can I build a page which allows a web user to update this box? Thanks.
      • 22815
      • 1,097 Posts
      Essentially, you’ve just hit the "web users can’t update snippets or chunks, and a TV is inappropriate as it needs to be the same on all pages" flaw.

      There are numerous workarounds but I can’t give you the precise details right now because my girlfriend wants to nick the laptop, but that’s the thing to do.

      Can you tell me: is the user is just typing names in, or selecting them from an existing db?
        No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
        MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
        Forum: Where to post threads about add-ons | Forum Rules
        Like MODx? donate (and/or share your resources)
        Like me? See my Amazon wishlist
        MODx "Most Promising CMS" - so appropriate!
        • 12844
        • 59 Posts
        Thanks Paul. At this stage the web user will be typing in the driver names and circuit name, and the date if this is easiest.

        Edit: I’ve temporarily inserted the real details into the podium box for now (just in case you’re wondering how they got there!).
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Of course they can... with a bit of coding and database management. I would presume this data is in a custom table? Have a snippet that checks the user’s web groups ($modx->isMemberOfWebGroup($array-of-group-names)) then uses the incoming form data to update the table. You can generate the form by querying the table to make a drop-down of driver names to select, an input to add a new driver, and even use the cute little javascript calendar for them to select a date. It would be fun making an Ajax app out of it!

          As far as web users updating snippets or chunks or documents, it’s only data in the database. A query will retrieve or add or modify the data, you just need to write the code to do so.
            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
            • 12844
            • 59 Posts
            Thanks Susan - all makes sense to me. Thanks for the pointers.

            As for Ajax, I don’t have a clue how to do that. But I assume building a ’standard’ version of the functionality is a good place to start?

            The members are all part of an SMF forum, so hopefully I’ll be able to include the member names from that in my form.

            Any other advice welcome, of course.