We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    I created this very basic snippet after migrating a set of web links from PostNuke to MODx (I’ll be posting the command-line scripts I used in the forums following this post). It just creates a simple listing of all the links in a specific folder. It uses optional chunk templates for both the listing, as well as for each individual link being listed, and even allows you to expose the actual URLs versus creating the links with the internal MODx alias.

    Not much documentation yet, but if you can follow the code, give it a try and see what else you can make it do... wink

    Just extract this to /assets/snippets/links/ and then copy/paste the contents of LinkCategory.snippet.txt into a new snippet in MODx. The list of variables at the beginning of the snippet are all the available options you can set. Feel free to comment or ask any questions.
      • 6726
      • 7,075 Posts
      Thanks Jason ! This could be a nice tool to manage a blogroll smiley Don’t know if I’ll be able to write a doc for it, but if I’ll give it a try...
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 2762
        • 1,198 Posts
        OpenGeek, can you explain how to use these variable??

        $linkTarget (ok this is the target link wink )
        $linkRel
        $linkClass
        $preLink
        $postLink
        $preText
        $postText
        $exposeUrls
        $showHidden
        $tpl
        $linkTpl
          Free MODx Graphic resources and Templates www.tattoocms.it
          -----------------------------------------------------

          MODx IT  www.modx.it
          -----------------------------------------------------

          bubuna.com - Web & Multimedia Design
          • 22303 MODX Staff
          • 10,725 Posts
          Here ya go...

          $linkTarget
          the value to render for the target attribute of the A tag (default "")

          $linkRel
          the value to render for the rel attribute of the A tag (default "")

          $linkClass
          the value to render for the class attribute of the A tag (default "")

          $preLink
          code to render before the opening A tag (default "")

          $postLink
          code to render after the closing A tag (default "")

          $preText
          code to render after the opening A tag and before the link text (default "")

          $postText
          code to render before the closing A tag and after the link text (default "")

          $exposeUrls
          determines if the URL in the href attribute should be exposed as the actual final link destination or the internal MODx destination (default true, which exposes the actual final destination URL)

          $showHidden
          determines if links with hidemenu=1 should be shown (default false, which means do not render links with hidemenu=1)

          $tpl
          a chunk name to use as a template for the overall output (default is defined in the class as:
          <div class="link_container"><ul>[+linkListing+]</ul></div>

          )

          $linkTpl
          a chunk name to use as a template for each link that is rendered (default is defined in the class as:
          <li>[+prelink+]<a [+title+][+href+][+target+][+rel+][+id+][+class+]>[+pretext+][+linktext+][+posttext+]</a> <span class="link_description">[+description+]</span>[+postlink+]</li>

          )

          I hope that helps
            • 2762
            • 1,198 Posts
            thanks Jason wink
              Free MODx Graphic resources and Templates www.tattoocms.it
              -----------------------------------------------------

              MODx IT  www.modx.it
              -----------------------------------------------------

              bubuna.com - Web & Multimedia Design
              • 6726
              • 7,075 Posts
              Very nice Jason, thanks for those tips smiley
                .: COO - Commerce Guys - Community Driven Innovation :.


                MODx est l&#39;outil id
                • 4273
                • 356 Posts
                any examples on how to call this ?
                  SMF Bookmark Mod - check it out
                  http://mods.simplemachines.org/index.php?mod=350
                  • 19777
                  • 35 Posts
                  I can’t seem to get this snippet to work.

                  In my &tpl chunk called LinkContainer I have:

                  <div class="archive"><dl>[+linkListing+]</dl></div>


                  In my &linkTpl chunk called LinkContent I have:

                  <dt><a [+href+]>[+linktext+]</a></dt>
                  <dd>[+description+]</dd>


                  In my template I have :
                  [!LinkCategory? &tpl=`LinkContainer` &linkTpl=`LinkContent`!]


                  I have a Folder called Links. This Folder contains some Weblinks.

                  This renders nothing. How do I use this snippet correctly?

                  Cheers

                  Mark
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Where are you placing this snippet call? It either has to be on a parent page containing the links, or you need to set the docId parameter specifically to the id of the folder container your links. For instance, if the link folder is the document with id = 12...

                    [!LinkCategory? &catDocId=`12` &tpl=`LinkContainer` &linkTpl=`LinkContent`!]

                      • 12389
                      • 8 Posts
                      Hi, found this post and tried to build the link list using the informations on this site.

                      No success an no idea what i’m doing wrong...

                      Ok, i have a folder called "links"
                      Within this folder there are folders "category 1" "category 2" etc.

                      In the category folders i build some weblinks.

                      In the main folder "links" i set the call

                      [!LinkCategory? &catDocId=`24` &tpl=`LinkContainer` &linkTpl=`LinkContent`!]

                      Id=24 is the id of the category 1 folder.

                      For the chunks i use LinkContainer and LinkContent with default content as shown above

                      I can’t get any output. The source code shows:

                      <div class="link_container"><ul><div class="link_container"><ul></ul></div>

                      When i remove the &catDocId=`24` the output is:

                      <div class="link_container"><ul></ul></div>

                      Maybe some one can help me (modx beginner ;-) )

                      Hotte