We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21589
    • 4 Posts
    I am evaluating ModX for a Medical Organization I am volunteering to build a website for.
    What I am looking for is something like a CCK (Custom Content Kit) like in Drupal.
    In other words, I would like to define content types and the fields through
    which the admin enters "content" For example, lets say that I am interested in
    maintaining a list of "Family Stories". Each "Family Story" has an Image, A body, A title, etc.
    I would like the admins to be able to enter the story, select an image and then check a box
    --> PROMOTE to front page or something. Then in a snippet(I am pressuming), I can read that
    data from the DB and render it it a way that I want to. Eventually, the website will have
    several content types like
    a) Family stories b) News Events c) Donation Drive details d)Upcoming clinics etc.

    In Drupal, CCK does something similar. Is there a way to do this in MOdx, without writing
    a bunch of code? [NOTE: I am a developer and I have good programming experience and know PHP.
    I am not against developing, I am just trying to see if there is already something that I coudl
    leverage]
    Thanks for your time and guidance. Sorry for the long post.

    Thanks

      • 34017
      • 898 Posts
      Hey nirguna,

      This is exactly what modx lets you do with template variables. I’ve got some forum posts with examples in my signature. Here’s a quick run-down.

      1. Each page-type is a template
      2. You can assign different fields to the template through template variables.
      3. In your template, you show your template variables with the syntax [*template_variable_name*]

      Template variables (extra fields) can be dropdowns, checkboxes, radios, images, RTE’s, dates, regular text inputs.
      For the list type items [dropdowns, radio, checkboxes], you can set the list dynamically
      The extra Quip will let you list other modx documents
      You can also create your own snippet and set the TV Input Option values to the following:
      - @EVAL return $modx->runSnippet(’YourSnippetName’,array(’parameter1’ => ’value1’, ’parameter2’ => ’value2’));

      PS - this is all for Evolution and may be the same for revolution, but im not sure
        Chuck the Trukk
        ProWebscape.com :: Nashville-WebDesign.com
        - - - - - - - -
        What are TV's? Here's some info below.
        http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
        http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
        • 21589
        • 4 Posts
        Thank you so much for your reply. I read about the template variables.
        i understand that if I create a TV and assign a doc to use that template,
        I can edit the data that is specific to that doc. Thats great.

        I still have a question. Lets say that I want a way to enter
        an unknown number of "family story" type. Each type, as I said earlier will have
        a set of fields. Some of them are marked with "promote to front page" lets say.

        1. How do you enter multiple values for a template variable
        like for example I want a way create, list, delete, and update family stories
        In otherwords there should be a complete data maintenance page for that type.

        2. Some of the instances of that type (family story) may have to
        appear on multiple pages. What thsi means is that the data must
        be stored in a central place (like DB) and accessible by muliple pages.

        I am not sure how to achieve this through the TVs. Any guidance is appreciated. Thanks for your time.

          • 34017
          • 898 Posts
          Hey nirguna,

          This is what I would do:

          1. Create a new Template called ’Family Stories Template’
          2. Create a new resource/document called ’Family Stories Folder’
          3. Create your Family Stories as children of ’Family Stories Folder’ with the template of ’Family Stories Template’
          -- 3a. You can use ’Inherit Parent Template’ to automatically set the children to use ’Family Stories Template’ (http://modxcms.com/forums/index.php?topic=27158.0)

          Then I would do the same thing for News Events, Upcoming Clinics (anything with multiple items that need to be listed).

          The menu tree could look like this:
          Home
          Family Stories Folder
          - Story 1
          - Story 2
          News Events Folder
          - News Event 1
          - News Event 2
          Contact
          Upcoming Clinics Folder
          - Clinic 1
          - Clinic 2
            Chuck the Trukk
            ProWebscape.com :: Nashville-WebDesign.com
            - - - - - - - -
            What are TV's? Here's some info below.
            http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
            http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
            • 21589
            • 4 Posts
            Thanks again. I get the point here.
            However these "family stories" are not necessarily visible or accessbible separately
            via an URL. I might be able to get these documents to be "hidden" or non public so thats fine.

            Here is a more interesting question.
            lets say that I have a folder called family stories and I have a bunch of
            family stories under them.

            On the home page I am interested in displaying a random family story.
            This requires ONE Document to load a bunch of other documents (family stories) and
            iterate through their data. Is this possible? Like $Modx->getDocument or something I would pressume.

            In a way, we are, essentially storing DATA as a DOCUMENT. While it might work,
            i would imagine that a better way would be to write a plugin or something that can
            maintain DATA + LCRUD operations on the data so that documents can read that
            data and display that data as they want. Am I off base here?
              • 34017
              • 898 Posts
              There’s so many ways to skin this cat. In modx, you really can do anything. This is one way to do it.

              Quote from: nirguna at Sep 06, 2010, 07:09 PM

              However these "family stories" are not necessarily visible or accessbible separately
              via an URL. I might be able to get these documents to be "hidden" or non public so thats fine.

              That’s not a problem. Just set the page to be unpublished. Or just let the content of ’Family Stories Template’ be a snippet that calls the modx $modx->sendErrorPage()
              Those are 2 ways you can keep the ’Family Stories’ from being accessible via a URL. You would probably want to turn on Friendly URL paths too.

              Quote from: nirguna at Sep 06, 2010, 07:09 PM

              lets say that I have a folder called family stories and I have a bunch of
              family stories under them.

              On the home page I am interested in displaying a random family story.
              This requires ONE Document to load a bunch of other documents (family stories) and
              iterate through their data. Is this possible? Like $Modx->getDocument or something I would pressume.
              You can do a number of things.
              - you could use the Ditto snippet
              - Since you know php, you could use the api $modx->getAllChildren, then get one of the ids randomly, and $modx->getTemplateVars(array(), ’*’, $random_doc_id)
              -- http://wiki.modxcms.com/index.php/API:DocumentParser

              Quote from: nirguna at Sep 06, 2010, 07:09 PM

              In a way, we are, essentially storing DATA as a DOCUMENT. While it might work,
              i would imagine that a better way would be to write a plugin or something that can
              maintain DATA + LCRUD operations on the data so that documents can read that
              data and display that data as they want. Am I off base here?

              Yeah you can do it a million ways. You can create a module so the site owner goes there to update the ’stories’. You could use Jott on the frontend. With modx, the world’s your oyster. This is just one way where you don’t have to do a lot of programming.

              MODx really is flexible, so just dig into it, and whatever way you want to do it is possible.
                Chuck the Trukk
                ProWebscape.com :: Nashville-WebDesign.com
                - - - - - - - -
                What are TV's? Here's some info below.
                http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
                http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
                • 21589
                • 4 Posts
                Awesome. I will try these.
                By the way - T H A N K S !!!!!!
                Much Appreciated.