We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14864
    • 24 Posts
    I have an html page already set up with a list of links.

    http://svr8.acornhost.com/~infinity/links_test.html

    Can someone point me in the right direction to make this list editable by the client. This needs to be idiot proof for the client to add and delete links and descriptions.

    Please help.
      • 3749
      • 24,544 Posts
      I’m assuming that the links are to actual pages on the site. If that’s the case, the user will only have to create the description (which could go in the Description field of the doc).

      Then use the Ditto snippet to create the list you show on the page with a Tpl chunk with something like this:

      <a href="[~id~]">[+description+]</a>




        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
        • 14864
        • 24 Posts
        Actually these are all external pages to other sites. They also need to keep the hover state. If you look at the page you can see what I mean. Right now they are an unordered list.
          • 3749
          • 24,544 Posts
          Sorry, I should have looked closer at the links on your page.

          In that case, one method would be to create a single document called "Links" with something like the following:

          Link:http://somesite.com
          Linktext:Some Site
          Description:Description of somesite.com
          
          Link:http://anothersite.com
          Linktext:Another Site
          Description:Description of anothersite.com
          
          etc.
          END-LINKS


          Then, you could create a snippet to get the page content, parse it, and create the list of links. Something like this:

          [[GetLinks? &docID=12]]


          Where 12 is the id of the unpublished Links document.

          <?php
          $doc = $modx->getDocument((string)$docID, '*', 1); // Search published first.
          if (empty($doc)) {
              $doc = $modx->getDocument((string)$docID, '*', 0); // Un-published next?
          }
          if (empty($doc)) { // user requested a non-existing document
             return ['Links Document not found'];
          }
          
          $output = "";
          
          $docString = $doc['content'];
          
          // parse the document and create the output here
          
          return $output;
          ?>


          If your PHP skills aren’t up to it, you could use a separate document for each link with the link in the longtitle field, the link text in the description field, and the description in the content field. Then use Ditto to produce your list with a Tpl chunk something like this:

          <li><a href="[+longtitle+]>[+description+]<br />[+content+]</a></li>


          Hope this helps.
            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
            • 14864
            • 24 Posts
            I will try both ways and see how that comes out.
              • 23299
              • 1,161 Posts
              I would imaging the second option that Bob presents here would be easier for your client once you have walked them through adding the various titles, links and descriptions. By having established documents for each link they could use them as a guide when adding new link pages.

              One of the things I come across often with clients is that they often understand everything after we tour the site once its completed. They get all the explanation that I offer when I "hand over the keys". But when some areas of the site are not used for a while I usually the get the "hey, we have forgotten how to..." questions when they want to do something. Having existing pages as a guide is a real aid here...
                • 14864
                • 24 Posts
                @Photowebmax

                Do you have any suggestions other then the ones listed above?
                  • 23299
                  • 1,161 Posts
                  I might be the wrong guy to ask as I do not have strong programming skills.

                  My $.02 is this: focus on the client...

                  In these forums you will find all kinds of incredible powerful options for doing this and doing that. Some of these solutions might be shear wizardry but if its complicated and involves too many steps like several TVs, chunks, calls, snippets and custom PHP, then maybe, just maybe the mousetrap is being overbuilt?

                  I usually ask clients: "do you have any HTML skills?" The answer I usually get is "a little". They know what code looks like and some actually know what it does. The simple code that the content div RTE produces is a great place to introduce working code to clients.

                  What you are presenting here is a glorified list of titles, outside web links and paragraphs. There are just three things that will get repeated over and over with each link page the client will be adding. I would ask them how they would like to do this. For example, I try to get my clients to tour the code that the RTE produces, the code that chunks produce etc, and so on. With complicated documents (aka, esources or pages.) I usually make an unpublished copy of some pages so that the clients can use the code as a "crib sheet" or a backup if their page editing session goes wrong somehow.

                  It all depends on the actual client, the client’s staff (who might be editing the site) and the page contents itself. Some page systems that I build will have long snippet calls that connect with code, chunks, TVs and Snippets. Other pages I simply make an unpublished copy and say "use that code and copy more entries", other pages will use the RTE with the client selecting custom styles that I have added via the Configuration manager. I also use a lot of CSS (if the content is going into a specific div then the client can then select the drop down Headline options in the RTE.) On some sites I will use all of these methods. Overall I am stronger with CSS than using scripting languages, so I make CSS work hard for me. Other folks are more comfortable with getting PHP or javascript to do the work.

                  There is no one way to use MODx. I am still learning. But my focus is mainly on the end design, usability and client’s needs. The client does come first though. Ask them what they are comfortable doing. I think it is a mistake to assume that the client does not want to learn anything. Use the parable of "its better to teach someone how to fish than to continually give them food." I like to get the client involved with their new site as much as possible. That includes going under the hood. You do need to know when to stop though. Overloading clients with two much detail may be worse than providing no guidance at all.

                  But before you put too much into this I would get feedback from your client as to how they want to add this kind of content.
                    • 14864
                    • 24 Posts
                    I figured out a way to do it with a custom tpl and wayfinder and it will be super easy for the customer to edit it as well.

                    Thank you all for all the help.
                      • 3749
                      • 24,544 Posts
                      Photowebmax has the right idea, IMO, the client should certainly play a big role in deciding how to do it.

                      I would strongly recommend a solution that involves either Ditto or a custom snippet to show the list. That way additions and deletions will automatically show up in the list.

                      If the client is not tech-savvy, I would probably just create a web form in the front end for entering the three pieces of data and a snippet to save the results as a document (a la NewsPublisher), with all the documents under one container. Then use Ditto to produce the list.

                      If the client is a little more savvy and can face the Manager, I’d use ManagerManager to customize the document form to prompt the user for each item and then use Ditto again to display them.
                        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