We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20991
    • 99 Posts
    This is a specific question which will probably provoke a broad answer, but I am wondering if there is a tutorial with MODx about a scenerio something like this:

    1. A members page has an alphabetical listing of members by name.
    2. Another page has an alphabetical listing of members by occupation.

    Each of these pages has a simple one-line-per-member listing with a link that links to the full member description like this:

    I
    Interior Redesign — John W. Smoke, Jr., Esq., Interior Redesign USA Ltd. LLC

    Or like this:

    John W. Smoke, Jr., Esq.
    , Interior Redesign USA Ltd. LLC — Interior Redesign

    depending on whether you are viewing by Occupation or Member Name.

    Either link will pull up the same result: a full description of the member and what he does with a little picture of the member, contact numbers, website, etc.

    3. That same data-- that is, all the members’ FULL descriptions-- need to be viewable when clicking the option "View All Members".

    So, somehow, MODx would have to retrieve all the full member descriptions from the database (an array, I would imagine) and stick it into the template.

    If at some point there are too many members, the template would display 10 members per page with a little navigation to view the next page, etc.


    ---
    So, is there anything like this remotely written in MODx besides the Kiwi shopping cart?
    Is it a simple thing to do?

    Thanks.
      NOTE TO SELF: http://www.muddydogpaws.com/development/wayfinder/examples/example-1.html for all your navigational questions.
      • 20991
      • 99 Posts
      This seems like the beginning of a solution:
      http://wiki.modxcms.com/index.php/API:DBAPI:makeArray

      function show_members() {
      	global $modx;
      	$output = '';
      	$table = $modx->getFullTableName( 'members' );
      	
      	$result = $modx->db->select( 'id, name, picture', $table, '', 'name ASC', '' );
      	$members = $modx->db->makeArray( $result )
      	
      	foreach( $members as $p_val ) {		
      		foreach( $p_val as $m_key => $m_val ) {	
      			$output .= '<strong>' . $m_key . ':</strong> ' . $m_val . '<br />';
      		}
      	}
      }
        NOTE TO SELF: http://www.muddydogpaws.com/development/wayfinder/examples/example-1.html for all your navigational questions.
        • 21257 MODX Staff
        • 730 Posts
        This may seem like a strange question, but does this list of members you want to display reflect the membership of your MODx users? Said another way, do the people in the list of members you want to display need to be able to log into the MODx site? Do they sign up for membership or are they granted access to the site by your webmaster?
          Mike Schell
          Lead Developer, MODX Cloud
          Email: [email protected]
          GitHub: https://github.com/netProphET/
          Twitter: @mkschell
          • 34017
          • 898 Posts
          nate,

          You could use loopdb (or dbloop) and a chunk to list the items one-per-line. Then you could use $_GET[’sortby’] (or something like that) to determine how the items are assorted.
            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