We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36613
    • 328 Posts
    I use Tagger component per my blog in modx. I want create a tag cloud and when i click on e tag i want filter page by tag, but don't work.
    I call this snippets for build the tag cloud:
    <ul class="sideLink">
    [[TaggerGetTags? &showUnused=`1` &rowTpl=`tag_links_tpl`]]
    </ul>

    The tag_links_tpl:
    <li><a title="[[+tag]]" href="[[+uri]]">[[+tag]]</a></li>

    The example uri is this:
    http://www.mysite.it/myblog/tags/#MYTAG
    In the "myblog" page call this snippets:
    [[!getResources?
    &parents=`[[++blog_id]]`
    &tpl=`childItemNews`
    &depth=`0`
    &showHidden=`0`
    &limit=`0`
    &includeTVs=`1` 
    &processTVs=`1` 
    &includeContent=`1`
    &sortby=`{"publishedon":"ASC","createdon":"DESC"}`
    &where=`[[!TaggerGetResourcesWhere? &where=`{"isfolder": 0}`]]`
    ]]
    


    But TaggerGetResourcesWhere doesn't take the GET tags parameters:

    if ($tags == '') {
        if (isset($_GET[$tagKey])) {
            $tags = $_GET[$tagKey];
        } else {
            return $modx->toJSON($where);
        }
    }


    $tagKey doesn't have value sad

    I must crete a rule in htaccess?




    This question has been answered by multiple community members. See the first response.

      • 36996
      • 211 Posts
      Hi Cristian,
      In your TaggerGetResourcesWhere snippet you need to include &tags = [[+tag]] to filter by tag.
      You also need to create a snippet that gets the $_GET[tag] from the uri, and inject it to the tag placeholder.
        • 36613
        • 328 Posts
        In the Tagger (http://rtfm.modx.com/extras/revo/tagger) documentation i read:
        &tags -> Comma separated list of Tags for which will be generated a Resource query. By default Tags from GET param will be loaded.
        In fact in the code:

        $tagKey = $modx->getOption('tagger.tag_key', null, 'tags');
        $tags = $modx->getOption('tags', $scriptProperties, '');
        $where = $modx->getOption('where', $scriptProperties, '');
        
        $where = $modx->fromJSON($where);
        if ($where == false) {
            $where = array();
        }
        
        if ($tags == '') {
            if (isset($_GET[$tagKey])) {
                [b]$tags = $_GET[$tagKey];[/b]
            } else {
                return $modx->toJSON($where);
            }
        }


        The problem is the url in my opinion. This url http://www.mysite.it/myblog/tags/#MYTAG dosen't get tags paraters.
        If i wirte echo: $_GET['tags'] return blanck result.
        • discuss.answer
          • 36996
          • 211 Posts
          Wow, I totally missed that part...
          Got it working, for me the uri is like:

          http://www.mysite.it/myblog/&tags=MYTAG 
          


          I have to say, Tagger is a really nice extra
            • 36613
            • 328 Posts
            Ok i found the problem smiley the problem in # character, if i use # before tag in tag in the URL the $_GET variabile doesn't read the value.
            Nir Zohar you can use [[+uri]] placeholder for url.
              • 36996
              • 211 Posts
              I am using the uri placeholder, just wasn't using friendly urls..
              Glad you got it sorted.
                • 36613
                • 328 Posts
                Quote from: nir-z at Jun 05, 2014, 01:14 PM
                I am using the uri placeholder, just wasn't using friendly urls..
                Glad you got it sorted.

                If i want see the resource with the same tags of a resources. Theis is a placeholder same [[*tags]] to use:
                [[!getResources? &where=`[[!TaggerGetResourcesWhere? &tags=`[[*tags]]` &where=`{"isfolder": 0}`]]`]]

                in page ?
                If i try use:
                [[TaggerGetTags? &resources=`[[*id]]` ]]

                i recive an array.

                My favourite resoult is this:

                [[!getResources?
                &parents=`[[++blog_id]]`
                &tpl=`childItemNews`
                &depth=`0`
                &showHidden=`0`
                &limit=`0`
                &includeTVs=`1`
                &processTVs=`1`
                &includeContent=`1`
                &sortby=`{"publishedon":"ASC","createdon":"DESC"}`
                &where=`[[!TaggerGetResourcesWhere? [b]&tags=`[[*tags]]`[/b] &where=`{"isfolder": 0}`]]`
                ]]

                [ed. note: cristianb88 last edited this post 9 years, 11 months ago.]
                • discuss.answer
                  • 36996
                  • 211 Posts
                  Maybe

                  [[!getResources?
                  &parents=`[[++blog_id]]`
                  &tpl=`childItemNews`
                  &depth=`0`
                  &showHidden=`0`
                  &limit=`0`
                  &includeTVs=`1`
                  &processTVs=`1`
                  &includeContent=`1`
                  &sortby=`{"publishedon":"ASC","createdon":"DESC"}`
                  &where=`[[!TaggerGetResourcesWhere? &tags=`[[TaggerGetTags? &seperator=`,` &tpl=`tagTpl`]]` &where=`{"isfolder": 0}` &resources=`[[*id]]`]]`
                  ]]
                  


                  and in tagTpl chunk:

                  [[+tag]]
                  
                  [ed. note: nir-z last edited this post 9 years, 11 months ago.]
                    • 36613
                    • 328 Posts
                    ok si not seed but work
                      • 36996
                      • 211 Posts
                      You can also have the TaggerGetTags call in a tv called tags, and then have the &tags=`[[*tags]]` in your TaggerGetResourceWhere.