We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38740
    • 45 Posts
    Hi, trying to build some custom pages to edit content in modx.


    How do i make intelligent custom functionality with modx?

    As i am used to asp-programming i used to put intelligence in the asp-code on the page that then rendered the output to build the page returned to the browser. I was in full control of the output.

    In modx it seems to be the other way around as you call chunck and snippets back and forth with limited intelligance between them, and i dont understand how to "get it smart"...

    For example:

    I have installed and are using the getResources-snippet that returns a list of resources by calling a chunk one by one. How can i add intelligance so i can analyze and render the output depending on the other resources in the list?

    Example 1, i would like to add a moveup/movedown button on each listed resource; to do that i need to know the previous and next resource id in the list, how?

    Example 2, i would like to number the list of resources from 1 to x just as they are listed. How can i keep a variable alive between the chunk that getResources are calling without using a session-variable?


    Maybe its so that i shouldnt use modx for custom solutions, but build the site entierly custom from scratch? I want a custom interface (controlpanel) for my users to update their content becauce i think the manager is to complicated for them.


    Any thoughts?

    thx smiley

    [ed. note: johnjohn22 last edited this post 14 years ago.]
      ____________________________________________________
      • 33968
      • 863 Posts
      Using getResources you have a number of config options that will get you more or less what you require here. You can set an id for each template using 'idx'. Have a look at tpl, tplFirst, tplLast, tpl_nN too:
      http://rtfm.modx.com/display/ADDON/getResources#getResources-AvailableProperties

      Also nothing is stopping you from coding up your own snippet (or adapting an existing one) if the existing ones don't provide the functionality you require out of the box.

      However it sounds like what you are trying to do might be better off done client-side, perhaps using jQuery. That way you could move items around in real time without needing to refresh the page.

      Regarding the manager, have a look at form customisation which will allow you to rename and hide fields depending on the logged-in user's access level. You can remove access to the top menu items by creating User Groups and assigning Access Policies with those menu permissions left unchecked.

      MODx is perfect for custom solutions, that's what it does best! Just spend a little time to learn how it works and you'll soon realise how much flexibility there is.
        • 38740
        • 45 Posts
        Thanks for your reply Lucas!

        I guess if i want to pursue the custom line i have to write my own snippets to get the maneuverability i want. Guess i can make my own db-queries and process the result if i examine the tables for a while.

        Will check out how customized the manager can get also.
          ____________________________________________________