We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31609
    • 2 Posts
    Virtual DarKness Reply #1, 20 years ago
    Hi,
    I’m new to modx and I’ve been reading the documentation and doing some tests but there are still some things that I don’t understand.

    I’ve a quite good php knowledge but (and this sounds great) modx introduces new concepts that I’m slowly getting used to..

    1- First of all I’ve read about @ bindings and found the @SELECT one very cool but then I’d expect to have the possibility to insert on a document the template variable as a dropdown, just like it happens when I do edit the page but with a different use: build a form..

    maybe I missunderstood the documentation:
    http://modxcms.com/what-are-at-bindings.html
    When placing @ bindings inside the “Input Option Values” field, they are used to format input options only when editing document within the Manager, for example to create a drop-down list of Cities or Countries.

    When placing @ bindings inside the “Default Value” field the returned value is used to render to the final web page. This makes it simple to build complex forms for data input on the web very quickly.

    2- this leads me to another thing: is there any standard method do build form or anyone just uses his code? Should I use something like the MakeForm snipplet?

    3- I’ve read that modules are for the manager and that you use snipplets inside your document.. so let’s say I want to build a simple module or snipplet that manages categories (just category id - category name) and then generic items (item_id, item_cat_id, item_title,..) that can use available categories as external relation (i.e. you select the category from a dropdown and then it stores in database the category id)..

    flollowing question are related to point 3 and are meant in both snipplet / module example cases:

    3a- Can I use the @SELECT binding to populate my dropdown? Both in module / snipplet?
    3b- How can I create a simple interface that displays the category / items list? I’ve tested the datagrid widget but maybe I should use something MakeTable to have also edit / delete item links .. ?
    3c- do you know if there is some simple module / snipplet that does this kind of I/O tasks that I could use as an example and/or more documentation (maybe in the forum) that I could look?


    Thanks a lot for your answers; if you know only the answer to one point please reply to it.. is better than nothing laugh Also I don’t need/want the full "howto" of how to do something like what I described on point 3, just some "where to start" information.. (see 3c).. and if something I wrote or the way I wrote it sounds a bit odd for you please keep in mind that english is not my first language wink Also I think that this post could be turn in a nice tutorial draft..

    bye and thanks,
    Giovanni.
      • 22303 MODX Staff
      • 10,725 Posts
      BTW, it’s snippet, not snipplet -- lol smiley that sounds too much like the dreaded "portlet" (shudder).

      Quote from: Virtual at Oct 01, 2006, 11:30 AM

      1- First of all I’ve read about @ bindings and found the @SELECT one very cool but then I’d expect to have the possibility to insert on a document the template variable as a dropdown, just like it happens when I do edit the page but with a different use: build a form..

      2- this leads me to another thing: is there any standard method do build form or anyone just uses his code? Should I use something like the MakeForm snipplet?
      You can use TVs within static forms you setup on pages, or you can use any of the form helper add-ons in the repository, including the eForm snippet, the MakeForm class (this is just a helper class that uses chunks as templates for each type of element and allows you to define each attribute of an element as a simple PHP array; you’ll have to write your own snippet with it to generate and/or process the form, though the class helps with those operations), and there are probably other solutions as well...

      Quote from: Virtual at Oct 01, 2006, 11:30 AM

      3- I’ve read that modules are for the manager and that you use snipplets inside your document.. so let’s say I want to build a simple module or snipplet that manages categories (just category id - category name) and then generic items (item_id, item_cat_id, item_title,..) that can use available categories as external relation (i.e. you select the category from a dropdown and then it stores in database the category id)..

      flollowing question are related to point 3 and are meant in both snipplet / module example cases:

      3a- Can I use the @SELECT binding to populate my dropdown? Both in module / snipplet?
      3b- How can I create a simple interface that displays the category / items list? I’ve tested the datagrid widget but maybe I should use something MakeTable to have also edit / delete item links .. ?
      3c- do you know if there is some simple module / snipplet that does this kind of I/O tasks that I could use as an example and/or more documentation (maybe in the forum) that I could look?
      3a - I believe this is possible in a module via the API, though someone who has actually coded a module might better be able to answer exactly how

      3b - I use MakeTable to easily create custom tables quite often; very similar approach to MakeForm, though I never got arround to turning MakeTable into using chunks as templates. But it can definitely be useful in producing tables of any array data quickly. Though you’ll still need to code a snippet to use the class; again, it’s just a helper class.

      3c - Not really (maybe someone else knows off the top of their head?), you’ll likely have a look through the existing modules to get ideas, and honestly, in my vision of the future of MODx, you’ll be able to soon create custom management pages or completely new management interfaces in the same way you create front-end pages, so for now it might be worth exploring the idea of simply creating a secure front-end page/snippet so you can implement the management and front-end pages/snippets in a consistent way. The MaxiGallery snippet takes this kind of approach for instance...

      Hope that helps some...
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I’ve got a demo module on my site for handling database access, you can log in to the manager as guest, password guestuser.

        There are three articles explaining how the module works, with files available for download as well.

        http://www.sottwell.com/database-module.html
          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
          • 31609
          • 2 Posts
          Virtual DarKness Reply #4, 20 years ago
          Quote from: OpenGeek at Oct 01, 2006, 01:08 PM

          BTW, it’s snippet, not snipplet -- lol smiley that sounds too much like the dreaded "portlet" (shudder).

          Doh! I fixed it in topic subject so the forum search feature will find it wink

          Thanks a lot OpenGeek and sottwell for your answers.. I’ll try to do some other test and I think I’ll go for the snippet way as suggested by OpenGeek..

          I do not promise anything but if I came up with some decent code I’ll package it as a code example smiley

          bye,
          Giovanni.