On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • This is a re-written post based on my earlier post which is hopefully more clear.

    I aim to have template-variables labelled tags, i.e. tag1, tag2, tag3, etc., which are text input variables only, to become Ajaxsearch search queries upon clicking them, thus the tag1, or tag2, or tag3. So e.g., "tag3" (whatever input text is entered) = search query in Ajaxsearch when tag3 is clicked.

    I know about tag linking with Ditto but for that I need to create category pages with the aliases to be identical to my tags input values that are selectable from a pre-defined list, and I dont want to do that. Simplest for my purposes is really to have a website visitor click the tag and that tag becomes the search query in Ajaxsearch.

    I figured the following to be the structure somewhat... :

    Code in my chunk where the tag should lead to the search-results page.
    <div class="tag1">
                             <a href=
                            "/search?search=[*tag1*]">[*tag1*]</a> 
                        </div>
    					<div class="tag2">
                          <a href=
                            "/search?search=[*tag2*]">[*tag2*]</a> 
                        </div>
    					<div class="tag3">
                           <a href=
                            "/search?search=[*tag3*]">[*tag3*]</a> 
                        </div>


    Code in my search results page:
    [!AjaxSearch? &language=`english` &showInputForm=`0` &ajaxSearch=`0` &tplGrpResult=`chunk_search_grpresult` &tplPaging1=`chunk_search_pagination` &tplResult=`chunk_search_layout` &showMoreResults=`1` &ajaxMax=`50` &highlightResult=`1` &tvPhx=`....` &withTvs=`...` &order=`...` &extenders=`...`!]


    I am not sure where and how I can set my tags (tag1, tag2, tag3) as input variables that trigger the Ajaxsearch query and search results to show upon clicking the tag1, or tag2, or tag3...?

    *** UPDATE: The problem is solved, basically by amending the code in the chunk above, with the correct search URL for each tag, the search query works... smiley *** Thanks to all and sorry for the confusion.

    This question has been answered by ronbonqqq. See the first response.

    [ed. note: ronbonqqq last edited this post 3 years, 10 months ago.]
    • I don't know if this is what you are looking for, but anyway: tagLinks and or TvTagCloud

      tagLinks
      Download: http://modx.com/extras/package/taglinks
      Wiki: http://wiki.modxcms.com/index.php/Tagged_blogging_with_Ditto#The_tagLinks_Snippet

      TvTagCloud
      Download: https://modx.com/extras/package/tvtagcloud
      • Stupid question maybe:

        Why have you gone down that road ?

        You can pre-define a tag parent and add all your tags as individual pages and ouput all of the articles tagged under that specific tag

        example:
        domain.com/tags/mytag1
        domain.com/tags/mytag2

        So on your article page / blog post, you output the tags using taglinks and they link directly to the tag page which displays all of the articles that use that tag
        • discuss.answer
          Quote from: iusemodx at Jan 29, 2016, 02:01 PM
          Stupid question maybe:

          Why have you gone down that road ?

          You can pre-define a tag parent and add all your tags as individual pages and ouput all of the articles tagged under that specific tag

          example:
          domain.com/tags/mytag1
          domain.com/tags/mytag2

          So on your article page / blog post, you output the tags using taglinks and they link directly to the tag page which displays all of the articles that use that tag

          Hi,

          Yes, I looked into this already. The only thing is that I will not have pre-defined tags and thus I cannot create catgory pages on forehand with the alias of the tag. I want to avoid that for each tag, I have to add it to my TV tags and create a unique category page for that tag. I thought it to be more efficient to just enter a tag at random and when a website visitor clicks that tag, he automatically searches the site for other articles with that same tag, thats it. The output of that search already matches with my requirements. So I hoped for a "link" that automatically triggers the Ajaxsearch when the random tag keyword is clicked.