We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25551 ☆ A M B ☆
    • 1,231 Posts
    I need some ideas of how I could use MODx and snippets to allow me to doing the following.

    I want a user to register with my site and within their profile or another page, I would like users to beable to join a category so I can have a search function for it. An example of what I mean. I would like a user to beable to use a dropdown or selection to narrow down a search but what I need it for might be the problem. I want a user to have a link to their profile in area A - B or C; or A and C only. The user would have a page or in their profile, with a set of checkboxes that lists their area of work. I want the choices that the user has made to be inserted on to the pages that list of other users that fall under this category.

    I can only think of adding people to individual usergroups and have their name or link displayed as per usergroup but how would I allow the user to add or subtract their name from a group if they made an error or what ever. The idea is to allow visitors or other users to narrow specifically what areas to look in and have a list of users who fall within the users choice.

    Hope that makes sense!

    Something similar to these selection boxes.

    http://www.newdesignpartners.com/Home/Default.aspx
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
      • 27330
      • 884 Posts
      maybe tvExplorer can help you doing that?
        • 25551 ☆ A M B ☆
        • 1,231 Posts
        Indeed, Dimmy recommended that but I seriously don’t understand how to get TVex working. The tuts are not clear for me and I have tried for bloody hours to get it working. Is there anyone with a demo site so I can check the manager to get a better understanding?
          Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
          AugmentBLU - MODX Partner

          BLUcart - MODX Revolution E-Commerce & Shopping Cart
          • 3707
          • 241 Posts
          I created a similar search using tvExplorer to what you want although mine isn’t connected to a user profile so I don’t know how you make TV’s editable via a profile page. I can’t show you a demo because the site isn’t live yet but I’ll try to explain how I did it. I’m assuming you have tvExplorer installed correctly.

          The site is a database of brands. Each brand has it’s own document with various bits of company information stored in TV’s, some of which are searchable. The attached image shows what the final search form looks like.

          As you can see, the search has five parameters, each filtering a different TV or document variable. So the first step is to create the TV’s for each parameter and assign them to the appropriate template, in this case the template for my brand documents. The TV values need to be populated for each brand document.

          The relation between form fields and TV’s is like this:

          Brand - searches the document [*pagetitle*] variable.
          Sector - searches a custom TV [*sector*] using the Listbox (Multi-Select) input type.
          Products/services - searches a custom TV [*products-services*] using the Text input type.
          Owner - searches a custom TV [*owner*] using the Text input type.
          Country HQ - searches a custom TV [*countryHQ*] using the DropDown List Menu input type.

          To create the seach form, I placed the tvExplorer call in a chunk {{brandSearchBuilder}} because the form appears on multiple page but you could put it straight into a template.

          {{brandSearchBuilder}}
          [[tvExplorer? &tveID=`bs` &dittoName=`Ditto` &dittoSnippetParameters=`tpl:brandResultsTpl|parents:9|depth:2|display:all|sortBy:pagetitle|sortDir:ASC` &formTPL=`brandSearchTpl`]]
          [+bs_tve.searchForm+]


          &tveID=`bs` - I used an ID for the call because I have more than one tvExplorer form on each page but you don’t need this if you only have one. If you don’t use the ID parameter, you don’t need to add bs_ to the placeholders.

          &dittoSnippetParameters=`tpl:brandResultsTpl|parents:9|depth:2|display:all|sortBy:pagetitle|sortDir:ASC` - these are just the standard Ditto parameters but in the format parameter:value|parameter:value. The equivalent Ditto call would be [[Ditto? &tpl=`brandResultsTpl` &parents=`9` &depth=`2` &display=`all` &sortBy=`pagetitle` &sortDir=`ASC`]]

          &formTPL=`brandSearchTpl` - this is the template chunk containing the actual form.

          [+bs_tve.searchForm+] - the placeholder for the &formTPL chunk. This would be [+tve.searchForm+] if you didn’t use the &tveID parameter.

          The template chunks are as follows:

          tpl:brandResultsTpl - the Ditto chunk for the search results (whatever you want the results to look like)
          <h4><a href="[~[+id+]~]">[+title+]</a></h4>


          &formTPL=`brandSearchTpl` - the search form template
          <form id="bs-form" action="your-landing-page" method="get" >
          <fieldset id="bs-fieldset">
          [+tve.keywordsSearch:excludeTVs->all:label->Brand+]<br />
          [+tve.sector:filter->9:label->Sector:tvtype->select:blankLabel->- Please choose -+]<br />
          [+tve.products-services:fullText->true:filter->7:includeTVs->products-services:label->Products/services+]<br />
          [+tve.owner:fullText->true:filter->7:includeTVs->owner:label->Owner+]<br />
          [+tve.countryHQ:filter->9:label->Country HQ:blankLabel->- Please choose -+]<br />
          </fieldset>
          <fieldset id="bs-buttons">
          <button type="submit" id="bs-button" name="bs_search" value="search">Search</button>
          </fieldset>
          </form>


          Each placeholder is replaced by a form field of the type specified, searching the variable specified and with any other parameters specified. Parameters are separated by a colon. See the docs for info on tvExplorer filters.

          [+tve.keywordsSearch:excludeTVs->all:label->Brand+]
          - uses text field element searching each entire brand document: exclude all TV’s from the seach (so just searches the document variables): attach the label Brand to the form field.

          [+tve.sector:filter->9:label->Sector:tvtype->select:blankLabel->- Please choose -+]
          - only search the [*sector*] TV: use filter type 9: attach the label Sector: use the select box form element: use the label Please choose - as the first option in the select box.

          [+tve.products-services:fullText->true:filter->7:includeTVs->products-services:label->Products/services+]
          - only search the [*products-services*] TV: use fulltext search (made the search case insensitive for me): use filter 7: include the [*products-services*] TV (not sure why that is needed!!): attach label Products/services

          The other placeholders work in the same way.

          The final step is to create the search results page. I created a separate document for the results and in the content area added the placeholder [+bs_tve.dittoList+]. This would be [+tve.dittoList+] if you didn’t use the &tveID parameter. This placeholder gets replaced by the Ditto output.
            • 25551 ☆ A M B ☆
            • 1,231 Posts
            Hey, I have been a bit busy with work so only just got back to working on this idea.

            Basically I have 2 input forms on the profile edit page and the user can alter the tv value. I have a drop down menu with these inputs options; yes==1||no==2. The drop downs are editing the 2 tv options on the that page. What I would like is to some how display all profiles that chose to list their page under list 1 or list 2, depending on which options they chose in their profile. I would like to list these names using ditto.

            How do I list on one page, all docs with a tv option selected as yes==1 for input 1 and not have them displayed if option no==2 is selected? Have this repeated on another page but for a different named tv.



              Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
              AugmentBLU - MODX Partner

              BLUcart - MODX Revolution E-Commerce & Shopping Cart
              • 25551 ☆ A M B ☆
              • 1,231 Posts
              Anyone able to offer any assistance at all?
                Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                AugmentBLU - MODX Partner

                BLUcart - MODX Revolution E-Commerce & Shopping Cart
                • 27330
                • 884 Posts
                not sure if I get you right, but if each user has it’s own document u can use ditto to output as tags I would think,
                something along this:

                [[Ditto? &id=`option` &tags=`option1` &display=`all` &tpl=`ditto-option-view` &tagData=`tvoption` &tagMode=`onlyTags` &parents=`7` ]]
                  • 25551 ☆ A M B ☆
                  • 1,231 Posts
                  Ok I have been trying to get this working this morning and it’s not going!

                  I have a parent (150) with 4 categories under it (documents)

                  Category (150)
                    +CSS desginers (151)
                    +Flash designers (152)
                    +Javascript desginers (153)
                    +XHTML designers (154)


                  Each users profile page is under parent 53

                  Designers (155)
                    +Rossco (156)
                    +Bill (157)
                    +John(158)


                  Each users page has 4 drop downs but this could be check boxes or whatever... basically the user select from one or all of the drop downs.  I would use checkboxes but I don’t know how to get the variables passed to the modx manager TVs in each document but I know how to do it with drop downs...  Here are the options

                  CSS
                    option = list me
                    option = don’t list me


                  Flash
                    option = list me
                    option = don’t list me


                  Javascript
                    option = list me
                    option = don’t list me


                  XHTML
                    option = list me
                    option = don’t list me

                  The user selects which department they wish to be listed under so their name or link to their profile appears in one of the child docs of the Category parent (150)

                  So say Rossco chose list me for all 4 options, a link to Rossco’s profile will be on each of the 4 category pages,
                  151,152,153,154; how ever John only chose XHTML so his name should only appear in the XHTML category 154.

                  I have modx setup to accept the users selection and store it on each of the users profile page in a TV. 

                  An example of the TV
                  variable name : tvxhtml
                  input type : dropdown list menu
                  input option values : yes==1||no==2


                  an example of how the form looks
                  <p>Listed XHTML Designer<label for="tvxhtml" class="Dspace1">
                  <select name="tvtvxhtml" id="tvtvxhtml">
                  <option value="1">List me under XHTML designers!</option>
                  <option value="2">Don't List me under XHTML designers!</option>
                  </select><
                  /label>
                  </p>


                  It’s called tvtvcss as I am using FDM and eform to pass the TV variables. 

                  On the XHTML category page I have a ditto call, I tried the following combinations but niether worked.

                  [!Ditto? &tags=`yes` &display=`all` &tagData=`tvxhtml` &tagMode=`onlyTags` &parents=`155` !]

                  tried
                  [!Ditto? &tags=`yes||no` &display=`all` &tagData=`tvxhtml` &tagMode=`onlyTags` &parents=`155` !]

                  tried
                  [!Ditto? &tags=`yes==1||no==2` &display=`all` &tagData=`tvxhtml` &tagMode=`onlyTags` &parents=`155` !]


                  tried
                  [!Ditto? &tags=`yes` &display=`all` &tagData=`tvxhtml` &tagMode=`onlyTags` &parents=`156` !]

                  tried
                  [!Ditto? &tags=`yes||no` &display=`all` &tagData=`tvxhtml` &tagMode=`onlyTags` &parents=`156` !]

                  tried
                  [!Ditto? &tags=`yes==1||no==2` &display=`all` &tagData=`tvxhtml` &tagMode=`onlyTags` &parents=`156` !]

                  Still no documnets found.

                  [!Ditto?  &parents=`155` !]

                  works and finds the users but this is not filtered by tags.

                  My understanding is growing but somethings are still beyond my capibilty so please excuse me!  If there is a far easier or slicker way to list users under categories then please help...  My idea is working as far as displaying the users on a filtered ditto list so hopefully a relatively simple solution will work. 


                  I do like the idea behind bob1000 example. TVe does look pretty nice but I simply can’t get things working.
                    Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                    AugmentBLU - MODX Partner

                    BLUcart - MODX Revolution E-Commerce & Shopping Cart
                    • 27330
                    • 884 Posts
                    Try this:
                    name the TV WhatIdo for example,
                    type-checkbox, widget-Delimited list, Delimiter -’,’
                    input option values- XHTML||CSS||JavaScript||Flash
                    check the required templates.

                    Then you can use Quill snippet to show the check boxes option on front end in your form like this:
                    <h3>Choose under which listing you want to show your profile</h3>
                    [[Quill? &mode=`control` &name=`WhatIdo`]]
                    


                    Then on your Category document call ditto like this:
                    <ul id="Profiles">[[Ditto? &id=`profiles`  &tags=`XHTML` &display=`all`&depth=`0`&tpl=`ditto-profile-view` &tagData=`tvWhatIdo` &tagMode=`onlyTags` &parents=`155` &display=`all`]]</ul>
                      • 25551 ☆ A M B ☆
                      • 1,231 Posts
                      Ok the TV works as far as being checked by a user... it does save on the users profile page in the TV area of modx. The problem is that on the category pages, it still says no docs found.

                      I’m using this call

                      <ul id="Profiles">[[Ditto? &id=`profiles` &tags=`XHTML` &display=`all` &depth=`5` &tpl=`GenericPagesTpl` &tagData=`tvWhatIdo` &tagMode=`onlyTags` &parents=`155` &display=`all`]]</ul>


                        Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                        AugmentBLU - MODX Partner

                        BLUcart - MODX Revolution E-Commerce & Shopping Cart