We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28436
    • 242 Posts
    Hello Guys,

    is there any solution to hide folders from the wayfinder output? I want to display only the documents in from the root level.

    currently i do it by the &parentClass Parameter and a css order. &parentClass=`hide`| .hide{display:none}
    But the full sourcecode of the naviagtion is displayed.

    The second way is to sort this rootnavigation in a separat folder, so the sourcode isent so heavy.
    The third way is to sort all the other categoriefolders in a separat folder to reduce the sourcecode.
    if i use aliaspaths, then i have to named them really meaningful. but i won’t do this.

    any solutions without hacking the wayfinderscript?

    thanks a lot and sorry for my horrible english, please ask if its not understandable.

    ciao, Stefan


      • 15987
      • 786 Posts
      just add the docids to the parameter &excludeDocs, you may be able to do it with some template changes also.
        • 28436
        • 242 Posts
        Hello kylej,

        thanks a lot for your hint, i already found this paramtert in the script a few minutes before your message reach me.

        And i try this to do it automaticly
        SELECT *
        FROM `modx_site_content`
        WHERE `id`
        IN (
        
            SELECT `id`
            FROM `modx_site_content`
            WHERE `parent` = '0'
            AND `isfolder` = '0'
        
        )


        i try this call
        &includeDocs=` SELECT `id` FROM `modx_site_content` WHERE `parent`=’0’ AND `isfolder`=’0’ `

        But... i got this back

        print_r( $wf->_config );

        Array
        (
        ...
        [includeDocs] => SELECT `id` FROM `modx_site_content` WHERE `parent
        ...
        )
        the string is cut after parent. Btw it is cut before the equal (=) character comes.

        I am confused, whats going on with it? Is it striped by the MODx snippet parser?

        ciao, Stefan





          • 28436
          • 242 Posts
          Ok, i found it in the document.parser class.

          nothing to do for me... not clever enough.

          I do it by the given strategy with the "excludeDocs" parameter.

          Thanks
          ciao, Stefan
            • 15987
            • 786 Posts
            putting all those backtics in the snippet call is not going to work. You just need to do a comma separated list of the docs you do not want to include. Its not very dynamic way of doing things, but it will work
              • 27376
              • 576 Posts
              Perhaps an [tt]&onlyFolders[/tt] and [tt]&onlyDocs[/tt] parameters would be a nice addition in the next release of Wayfinder? Or maybe just an [tt]&only[/tt] parameter where a use inputs `docs` or `folders` smiley
                • 28436
                • 242 Posts
                Hello

                putting all those backtics in the snippet call is not going to work.
                Maybe, but its the properly way to ask mysql for some datas.

                And for example, this one work.
                &includeDocs=` SELECT `id` FROM `modx_site_content` `

                The document parser explode the snippetparamters by the "=" and thats the reason, why the query will not work.
                I want to tell to it(the parser) "dont touch any character between the delimiter(backtics) " But i haven’t the abilities to to that....
                who cares, its fine how it is.

                Its not very dynamic way of doing things, but it will work
                just semi-dynamic, i call a snippet that select the ids and give it back as a comma separated list.

                Thank you for listening. Thank you for your great script.

                have a nice day, Stefan
                  • 28436
                  • 242 Posts
                  Hello kyle,

                  its possible to perform this dynamic snippet call

                  [!Wayfinder?startId=`0` &titleOfLinks=`longtitle` &includeDocs=` SELECT `id` FROM `modx_site_content` WHERE `parent` = ’0’ AND `isfolder` = ’0’ `!]

                  Two things to do:

                  1. its too dangerous to change the explode marker to another sign i.e "==", so change the equal characters in the parameter value to another marker like "<eq>"

                  [!Wayfinder?startId=`0` &titleOfLinks=`longtitle` &includeDocs=` SELECT `id` FROM `modx_site_content` WHERE `parent`<eq> ’0’ AND `isfolder` <eq> ’0’ `!]

                  2. Replace the marker with the real equal sign in the document parser line 850 (0.9.6)
                  $parameter[$parameterTemp[0]]= str_replace('<eq>','=',$parameterTemp[1]);


                  Thats not a heavy change and its not risky to do that. And it work.

                  Ok, in your(wayfinder) case maybe its better to add some new parameter like sirlancelots suggestion but it can be a improvment for the snippets itself. I guess that a lot of peoples know what to do with a functionality like that.

                  thank you.
                  ciao, Stefan


                  edit:

                  jesus, its dangerous .... need another marker.... mabye "<eq>" smiley
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Why not do #2 in the snippet itself rather than hacking the main file of MODx?
                      • 28436
                      • 242 Posts
                      Hello OpenGeek,

                      thats a good question and in the meanwhile i do it in the snippet.
                      For a short while i thought i found a usefull thing.... forget it.

                      ciao, Stefan