We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26466
    • 10 Posts
    Hi.

    I am considering using Modx for a site, and while almost all my concerns have been met by reading the wiki and these forums, I have a slightly complicated situation, for which I am unsure of the best method to attempt.

    When answering, please take into account that the site content is intended to be edited by a company secretary, not a computer "whizz" by any standards - I need to make the user experience as easy as possible.

    Essentially, the site has, as a main nav item, "Our Staff". This then leads to subfolder pages, with "Arthur Adamson, Betty Bevis, Charles Cowpat etc" each having a page. Each page in this section would have the staff member’s email, and role in the company, eg, "Artist, Builder, Car-washer etc"

    Now it gets complicated.

    Another item in the main nav is "services", which will have pages for "Artist, Builder, Car-washer, etc".

    I need somehow to link the people in each role to the role, so when, say, "Artist" is displayed, alongside the Artist content, "Arthur Adamson" and "[email protected]" appear in the Artist page.

    Is there anyway to get the staff who are in a particular role? Or should I write some PHP to do it in a snippet, assuming that I tag the staff member with their role in, say, the document summary?

    I realize the easiest solution would be to put the name/email into a Template variable,and have the client edit that.

    However, ideally I’d like an automatic link-up so that when "Anthony Apple" is added, and assigned to "Artist", the "Artist" services page will immediately display his name as well as Arthur’s




      • 30585
      • 833 Posts
      You should try WbloginPe and customize it.

      From what I understand, you need a user management System and WebLoginPe does just that. See > http://modxcms.com/extras.html?view=package/view&repository=10&package=495
        A MODx Fanatic
        • 26466
        • 10 Posts
        Thank you both.

        treigh - WebLoginPE is not really what I am looking for, but will be useful on another project.

        ganeshXL - Thanks that is exactly the direction I needed. I considered using folders but decided that it would be too complicated for the "admin" user to manage.

        After some experimentation with Ditto and the revalation that a chunk in a page has access to that page’s template variables, I have the problem solved, in the following manner (perhaps it will help other newbies)

        I have two page templates- one for services, one for staff members. Staff has a template variable named "emailAddress"

        I create a staff page, with title "Adam Adamson" and enter page content and his email address. I also created a "role" template variable (a dropdown list) to tag staff pages with the various options "Artist, Builder, Car-washer etc"

        Then in the "services" template, there is a ditto call referencing a chunk, limiting the info returned to those pages that have their TV-Roles template variable set to "Artist", and drawing only from the "Staff" folder, id of 5 (in theory this would not be necessary as only staff pages can be tagged with TV-Roles)
        [!Ditto? &startID=`5` &tpl=`serviceStaffLinks` &tagData=`tvTV-Roles` &tagDelimiter=`,` &tagMode=`onlyTags` &tags=`Artist`!]
        

        The serviceStaffLinks chunk is very simple:
        <a href="[~[+id+]~]"> [+title+]</a> email - [+emailAddress+]<br />
        

        What is returned is the link to the staff pages, and their email addresses.

        Modx is pretty impressive.

        Now, for 1st prize, is it possible, in the Ditto call, to use the current page title as the &tags variable? Eg, if we are on the "Services/Artists" page, that the Ditto could use that Title in a manner like this (not working)?
        [!Ditto? &startID=`5` &tpl=`serviceStaffLinks` &tagData=`tvTV-Roles` &tagDelimiter=`,` &tagMode=`onlyTags` &tags=[+title+] !]
        

        Otherwise, I’d have to create a template for each service, which does not seem to be an optimal way to go about things.
          • 3707
          • 241 Posts
          Try
          [!Ditto? &startID=`5` &tpl=`serviceStaffLinks` &tagData=`tvTV-Roles` &tagDelimiter=`,` &tagMode=`onlyTags` &tags=[*pagetitle*] !]
            • 26466
            • 10 Posts
            That is perfect.

            Thank you.